I just did a simple practice project to learn more about querystrings... I have three check boxes and a button. Checkbox1 is titled red, Checkbox2...white, Checkbox 3...blue. When I click the button 1, I just want the page to redirect and pass the values of the checked boxes to the querystring and show only the message “You’ve checked:” to appear and the color(s) checked. I have here my pageload code and button code. Can you look at my querystring and see what I’m not doing correctly?

p.s. The redirect will occur on the same page. I have different page views (showall and addrecord)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then

            If Request.QueryString.Count > 0 Then
                ToggleView(PageView.AddRecord)

                Response.Write("You've Checked: ")
                
                Select Case ("color")
                    Case "red"
                        If Me.CheckBox1.Checked = True Then
                            Response.Write(Me.CheckBox1.Text)
                        End If
                    Case "white"
                        If Me.CheckBox2.Checked = True Then
                            Response.Write(Me.CheckBox2.Text)
                        End If
                    Case "blue"
                        If Me.CheckBox3.Checked = True Then
                            Response.Write(Me.CheckBox3.Text)
                        End If
                End Select

            Else
                ToggleView(PageView.ShowAll)
            End If

        End If

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

        'Response.Write("You've Checked: ")

        'If Me.CheckBox1.Checked = True Then
        '    Response.Write(Me.CheckBox1.Text)
        'End If
        'If Me.CheckBox2.Checked = True Then
        '    Response.Write(Me.CheckBox2.Text)
        'End If
        'If Me.CheckBox3.Checked = True Then
        '    Response.Write(Me.CheckBox3.Text)
        'End If

        Response.Redirect("Default.aspx" & "?color=red=" & Me.CheckBox1.Text & "?color=white=" & Me.CheckBox2.Text & "?color=blue=" & Me.CheckBox3.Text)

    End Sub

You do
1.

Select Case ("color")

Because the value = "Color" it will never be anything else so it wil never fall in red, white or blue.

try this

Select Case (Request.QueryString("color"))

2. QueryStrings are name-value pairs (name=value), you have (color=red=text)

3. duplicate names

4. only after the page the is a "?" the others are "&"
pagename.aspx?cb1=value&cb2=value&cb3=value

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.