Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Sending a session variable to a custom control

Reply
Thread Tools

Sending a session variable to a custom control

 
 
Scott
Guest
Posts: n/a
 
      12-11-2003
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.


 
Reply With Quote
 
 
 
 
Jeffrey Tan[MSFT]
Guest
Posts: n/a
 
      12-12-2003

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.

 
Reply With Quote
 
 
 
 
Scott
Guest
Posts: n/a
 
      12-12-2003
That worked! Thank you!

Scott

""Jeffrey Tan[MSFT]"" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System Session Variable VS. Own-declared 'Session' Variable chowchho ASP .Net 7 03-28-2008 02:38 PM
Capturing event from other custom control within another custom control Jonah Olsson ASP .Net 1 04-05-2005 01:39 PM
Sending Variable content, not Variable name Ian Hubling Javascript 2 04-29-2004 12:26 AM
Sending ASP Session Variable to Word Macro Colin Steadman ASP General 0 01-19-2004 03:25 PM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM



Advertisments