Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I have an aspx page that loads a ascx control. On the ascx page, I have text fields that I would like to store the users input into session variables. How do you set that up with ascx pages? Do I declare the session variables on the aspx page that loads the control or can I do it on the ascx page? Does anyone have examples of doing exactly this?:)
Posted

So on the page load of the aspx page, do I declare the session variable? For example:

 

If Page.IsPostBack Then

 

'Load report generated from input

 

Else

Session("Subject") = ""

SubPageCtrlMain = LoadControl("modules/dcInput.ascx")

MainPage.Controls.Add(SubPageCtrlMain)

 

End If

 

 

There is an excute query button on the dcInput.ascx page which automatically posts back to above. I can't get it to do any execution on it's own even. (asp:button) So, how would I then save the client input?

Posted

Try...

 

<asp:LinkButton OnCommand="btn_Click"</asp:LinkButton>

 

<script language="VB" runat="server">

 

Sub btn_Click()

 

Session("Subject") = "Hello"

Response.Redirect(Request.ApplicationPath)

 

End Sub

 

</script>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...