Session State and Custom Controls

Results 1 to 2 of 2

Thread: Session State and Custom Controls

  1. #1
    Join Date
    Dec 1969

    Default Session State and Custom Controls

    Hello,<BR><BR>I&#039;m having a problem using session state variables in a custom control. First of all, I tried setting a custom control&#039;s property using server side script and got an error saying that you can not put server side script in a server tag.<BR><BR>eg. &#060;myprefix:mycontrol someproperty="&#060;%=Session("SomeVar")%&#062;" /&#062;<BR><BR>Another thing. In my render event of my custom control I need to use Session variables. I know I can pass them from what ever page is using the control, but I&#039;d like the code to be contained within the custom control. How come I can not access Session state within the custom control class itself???<BR><BR>Please Help, <BR><BR>Rob

  2. #2
    Join Date
    Dec 1969

    Default RE: Session State and Custom Controls

    If i remember correctly asp controls do not allow you to pass secondary asp code like what your doing. This code will not even work in datagrid or any other controls. Therefore your code someproperty="&#060;%=session("somvar")%&#062;" will generate a big old error. As for a work around, well sorry I&#039;m don&#039;t have one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts