none
Passing Back lisbox values when going back to previous page RRS feed

  • Question

  • Hi everyone, I hope somebody could give me a hand.

    I have a search page with a couple of pulldowns. Dependig on the values of them I show a grid matching the searched criteria, basically a table with links the user can navigate to. My problem comes when the user wants to navigate back. At the moment I have a "Back" button which simply redirects the user to the initial search page. I think it would be a good improvement to have the values of the pulldowns filled in with the values the user selected, this way when he presses the "Back" button he would not have to restart the whole search process again.

    Thursday, July 23, 2009 8:31 AM

Answers

All replies

  • by pulldowns, do you mean comboboxes?
    but most important, is this a VB.NET question , or other?
    if vb, here's a newbie reply:

    2 comboboxes, 2 labels, 1 button (back button).

    Public Class Form1
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            ComboBox1.Items.Add("1")
            ComboBox1.Items.Add("2")
            ComboBox1.Items.Add("3")
            ComboBox2.Items.Add("a")
            ComboBox2.Items.Add("b")
            ComboBox2.Items.Add("c")
            Label1.Text = "0"
            Label2.Text = "0"
        End Sub
        Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
            Label1.Text = ComboBox1.SelectedIndex
        End Sub
        Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
            Label2.Text = ComboBox2.SelectedIndex
        End Sub
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            ComboBox1.SelectedIndex = Label1.Text
            ComboBox2.SelectedIndex = Label2.Text
        End Sub
    End Class

    trujade..

    i like: VB General   google   fast cars   username password
    Thursday, July 23, 2009 8:49 AM
  • by pulldowns, do you mean comboboxes?
    but most important, is this a VB.NET question , or other?

    I'm curious about the same information too.  I couldn't be sure of the meaning of anything when I read the question.  And the question doesn't seem to have anything to do with the thread title.  I'll try to help when I see more details.



    Doug

    SEARCH ... then ask
    Thursday, July 23, 2009 9:30 AM
  • I guess I didn´t explain myself well enough.

    Lets say I have a search page to search apartments.

    I have a combo for the state, other for city, other for price range and depending on this selections, I paint a table with the apartments found. When the user click on any of the apartments it takes him to a details page showing the details of the apartment. In this details page I have a back button which should return the user to the search page. The thing is that I would like to keep the values the user selected in the first place when he clicks the back button so that it shows the apartments found.

    Let say the user selected State: Florida, City:Jacksonville, Price Range: 600$-800$ I want to keep those values when he goes back to the search page.

    Hope this is a bit more clear.
    Thursday, July 23, 2009 9:58 AM
  • Hi paydog,

    just hide the "Search" Form instead of closing(disposing) it. In that way the selected items will stay.
    If you have got questions about this, just ask. Mark the thread as answered if the answer helps you. This helps others who have the same problem !
    • Proposed as answer by _-Steve-_ Thursday, July 23, 2009 10:35 AM
    • Marked as answer by Yichun_Feng Wednesday, July 29, 2009 6:48 AM
    Thursday, July 23, 2009 10:01 AM
  • Hi paydog,

    Is it an ASP.NET project?
    This forum is for winform application. You can go to ASP.NET forum for better answer.

    For passing the values between pages, there are several methods. Here is an introdution:
    http://www.dotnetbips.com/articles/c585b4d3-93c5-4c66-9d49-8e1946f4d311.aspx


    Best Regards

    Yichun Feng

    • Marked as answer by Yichun_Feng Wednesday, July 29, 2009 6:48 AM
    Monday, July 27, 2009 10:43 AM