Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8382079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:51:01+00:00 2026-06-09T16:51:01+00:00

I have checkbox control on gridview with the ability to check all and uncheck

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:51:03+00:00Added an answer on June 9, 2026 at 4:51 pm

    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 StringBuilder and save repeated instantiation of Strings.

    Dim uItems As New StringBuilder("http://default.html?gen=")
    
    For Each r As GridViewRow In GridView1.Row
        If CType(r.Cells(0).FindControl("recs"), CheckBox).Checked Then
            uItems.AppendFormat("{0},", r.Cells(1).Text)
        End If
    End For
    
    -- Remove trailing delimiter
    uItems.Remove(uItems.Length - 1, 1)
    
    uItems.Append("&NO=3&F=1")
    

    With this code uItems.ToString() will give you somthing like this

    http://default.html?gen=bla1,bla2,bla3&NO=3&F=1
    

    it may be that you actually want somthing like this.

    Dim uItems As New StringBuilder("http://default.html?")
    
    Dim checkCount = 0
    For Each r As GridViewRow In GridView1.Row
        If CType(r.Cells(0).FindControl("recs"), CheckBox).Checked Then
            uItems.AppendFormat("g{0}={1}&", checkCount, r.Cells(1).Text)
            checkCount += 1
        End If
    End For
    
    -- Remove trailing delimiter
    uItems.Remove(uItems.Length - 1, 1)
    
    uItems.Append("&NO=3&F=1")
    

    This will enumerate the checked cells in your query string and give you somthing like this.

    http://default.html?g1=bla1&g2=bla2&g3=bla3&NO=3&F=1
    

    To Return a URL for each checked Item

    Dim urlItems = New List(Of String)()
    
    Const urlFormat As String = _
        "http://default.html?gen={0}&NO=3&F=1"
    
    For Each r As GridViewRow In GridView1.Row
        If CType(r.Cells(0).FindControl("recs"), CheckBox).Checked Then
            Dim url = String.Format(urlFormat, r.Cells(1).Text)
            urlItems.Add(url)
        End If
    End For
    

    This makes urlItems that is a generic List of Strings, each item being a url


    Okay the bit above shows you how to get a list of url Strings so, to iterate the urls do

    For Each url As String In urlItems
        //... Some code for POSTing or GETting .. your request 
    End For
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a listview and each Item has a CheckBox control as part of
I have a Custom Control that has multiple textbox fields and a checkbox contained
I have an ASP.NET login control on a page, with the Remember Me checkbox
I have a textbox control and a checkbox list control on my page. I
I have a GridView control on my ASP.NET page that binds to result set
I have a gridview control with a checkbox field and several bound fields. The
I have my check box control as shown. <ItemTemplate> <asp:CheckBox ID=chkdelete runat=server Text='<%# Bind(OrderNumber)
I have custom upload control. The control has gridview with the uploaded documents and
I have a gridview that has a template field containing a checkbox as one
In my application I have methods which returns a control (checkbox, radiobutton, textbox) but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.