locked
passing data from controls to session then taking the data and writing custom sql queries to get data from the database RRS feed

  • Question

  • User-956384462 posted

    Hi, I'm making a property search.

     I want to get data from controls and store in a session object which saved in the session until remove or close the browser

     so on the next page I can take the data stored in the session and use it to write a custom sql query using vb.net or stored procedure to get data from the database and then display the date in the list of results page.

     Can anyone help with this or forward me to some tutorials that could help me.

     Thanks

    Andy

    Thursday, July 10, 2008 7:00 AM

Answers

  • User-158764254 posted

    But I get no value in the textbox

    change this

            stringName = TextBox4.Text 

    to this

           TextBox4.Text =  stringName

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 13, 2008 2:06 PM

All replies

  • User-362017084 posted

    Hey

    try this

    session["name"]=TextBoxName.Text; 

    And in another page where u want to use this

    use stringName=session["name"];

    hope this will solve your problem 

    Thursday, July 10, 2008 8:24 AM
  • User-956384462 posted

     Hi, thanks for your help

    I'm having a couple of problems

    On my first page I've got a dropdownlist with categorynames with ids as values = 1 to 4

    On button click:

     Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

            Session("category") = ddlcategory.SelectedValue
            Response.Redirect("searchresults.aspx")
        End Sub

     Then on the second page I was hoping to pick up the value in the session:

    Partial Class SearchResults
        Inherits BasePage

        Sub Page_Load()
            Dim stringName As String = Session("category")
            stringName = TextBox4.Text
        End Sub

    End Class

    But I get no value in the textbox

    In addition, is it possible to send multiple values into the session. Would using query string be easier?

    Saturday, July 12, 2008 10:37 AM
  • User-158764254 posted

    But I get no value in the textbox

    change this

            stringName = TextBox4.Text 

    to this

           TextBox4.Text =  stringName

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 13, 2008 2:06 PM
  • User-956384462 posted

     Is it possible to have multiple session variables?

     Thanks

    Andy

    Monday, July 14, 2008 2:19 AM
  • User-158764254 posted

    yes - you can have multiple Session variables

    Monday, July 14, 2008 4:03 AM
  • User-990694832 posted

    As an alternative, a person could use the previous page property elimainating the need to store a value in the session.

    The following is one of many examples on the net. 

    Hope this helps

    DK

    http://msdn.microsoft.com/en-us/magazine/cc163722.aspx

    Monday, July 14, 2008 8:17 AM