I have checkbox control on gridview with the ability to check all and uncheck all.
The page also uses pagination. Each page has 25 records. Of course anymore more goes to the next page.
A user checks one or more checkboxes and user’s selections are processed using the code below:
Dim uItems As String = String.Empty
For Each r As GridViewRow In GridView1.Rows
If CType(r.Cells(0).FindControl("recs"), CheckBox).Checked Then
If uItems <> String.Empty Then
uItems += ","
End If
uItems += "http://default.html?gen=" & r.Cells(1).Text & "&NO=3&F=1"
End If
Next
If a user checks 15 or less, then you get this:
http://default.html?gen=" & r.Cells(1).Text & "&NO=3&F=1 this works because you get as many as you checked.
The issue we are having currently is that if a user checks more than 15 checkboxes, we get
“Internet Explorer cannot display webpage; what you can try – diagnose connection…”
After several troubleshooting, we discovered that the reason it is breaking is we could pass more than 15 values from cell(1) to the that link.
Does anyone know of a workaround to this?
This was exactly the same problem I posted yesterday except that I was describing it incorrectly, thereby making it difficulty for experts to give the correct solution.
Thanks for your help.
I suspect that you are generating a query string that is too long but there are other issues with the code. I’ve changed it to use a
StringBuilderand save repeated instantiation ofStrings.With this code
uItems.ToString()will give you somthing like thisit may be that you actually want somthing like this.
This will enumerate the checked cells in your query string and give you somthing like this.
To Return a URL for each checked Item
This makes
urlItemsthat is a generic List of Strings, each item being a urlOkay the bit above shows you how to get a list of url Strings so, to iterate the urls do