Sending a session variable to a custom control

Discussion in 'ASP .Net Building Controls' started by Scott, Dec 11, 2003.

  1. Scott

    Scott Guest

    I have the following code in my aspx page which calls my custom control
    (this works):

    <cc1:matextbox id="matextbox1" runat="server">
    <questioninfo typReportID= "This is where a number goes">
    </cc1:matextbox>

    This is fine for a test, but I really need it to use a session variable
    instead of the text in the 2nd line. But when I change the 2nd line to look
    like the following -

    <questioninfo typReportID = '<%# session("reportNumber") %>'>

    I get the error:

    BC30676: 'DataBinding' is not an event of 'inputWebControls.QuestionInfo'

    I don't get it. I am not databinding. I just want to pass a string to the
    variable so I can use it in the logic in the control. The control is NOT
    being built on the page in a grid, list or repeater, it is just in a <form>
    tag, that's it. Anyone know why am I getting this error?

    Scott
    BTW: using VB in the behind code. :)
     
    Scott, Dec 11, 2003
    #1
    1. Advertising

  2. Hi Scott,

    <%# %> is only used for DataBinding.
    I think you should set your custom control's attribute in the code behind.
    Custom control is actully a webcontrol, which abstract the attribute of its
    HTML tag as properties.

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
     
    Jeffrey Tan[MSFT], Dec 12, 2003
    #2
    1. Advertising

  3. Scott

    Scott Guest

    That worked! Thank you!

    Scott

    ""Jeffrey Tan[MSFT]"" <> wrote in message
    news:...
    >
    > Hi Scott,
    >
    > <%# %> is only used for DataBinding.
    > I think you should set your custom control's attribute in the code behind.
    > Custom control is actully a webcontrol, which abstract the attribute of

    its
    > HTML tag as properties.
    >
    > Best regards,
    > Jeffrey Tan
    > Microsoft Online Partner Support
    > Get Secure! - www.microsoft.com/security
    > This posting is provided "as is" with no warranties and confers no rights.
    >
     
    Scott, Dec 12, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jonah Olsson
    Replies:
    1
    Views:
    604
    Scott Allen
    Apr 5, 2005
  2. chowchho
    Replies:
    7
    Views:
    659
    Patrice
    Mar 28, 2008
  3. Matt Sokol
    Replies:
    2
    Views:
    413
    Theo Tillotson
    Aug 7, 2003
  4. Colin Steadman

    Sending ASP Session Variable to Word Macro

    Colin Steadman, Jan 19, 2004, in forum: ASP General
    Replies:
    0
    Views:
    145
    Colin Steadman
    Jan 19, 2004
  5. Ian Hubling

    Sending Variable content, not Variable name

    Ian Hubling, Apr 28, 2004, in forum: Javascript
    Replies:
    2
    Views:
    113
    Ian Hubling
    Apr 29, 2004
Loading...

Share This Page