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 8126835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:18:00+00:00 2026-06-06T07:18:00+00:00

<tr> <td width=60%><asp:CheckBox ID=chk0 runat=server /> …</td> <td width=40%><asp:CheckBox ID=chk1 runat=server /> …</td> </tr>

  • 0
<tr>
<td width=60%><asp:CheckBox ID="chk0" runat="server" /> ...</td>
<td width=40%><asp:CheckBox ID="chk1" runat="server" /> ...</td>
</tr>
...
...
...

I have values coming in like this:

var lst = "18,6,0,7,0,4,0,1,5,0,2"

If 18 is there then chk18 is checked and ect… 0 just means no getting checked. Is there an ideal way to code this? whileloop be ideal?

The values are coming from a database table all the data is in that format.

  • 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-06T07:18:03+00:00Added an answer on June 6, 2026 at 7:18 am

    Note, this will not work for your control ‘chk0’ and will blow up if you don’t have a correlating checkbox (ex = 18 is in your data, but you have no control chk18).

        Dim strData As String = "18,6,0,7,0,4,0,1,5,0,2"
    
        Dim lstIDs As List(Of String) = strData.Split(",").ToList()
    
        For Each strID As Integer In lstIDs
    
            If CInt(strID) > 0 Then
    
                CType(Page.FindControl("chk" & strID), CheckBox).Checked = True
    
            End If
    
        Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a checkbox inside a gridview like this <asp:GridView ID=GridView1 runat=server BorderColor=Blue BorderWidth=1px
I have a GridView with a Checkbox on the first column: <asp:GridView ID=dgNumeradores runat=server
I have this CheckBoxList on a page: <asp:checkboxlist runat=server id=Locations datasourceid=LocationsDatasource datatextfield=CountryName datavaluefield=CountryCode />
protected void GridView1_DataBound(object sender, EventArgs e) { GridView1.Columns[0].ItemStyle.Width = 400; <asp:GridView ID=GridView1 runat=server DataSourceID=ObjectDataSource1
I have repeater with item template: <asp:Repeater ID=queryParametersRepeater runat=server DataSourceID=queryParametersObjectDataSource> <ItemTemplate> <tr class=itemTemplate> <td
Using VS 2008, I have a Repeater control: <asp:Repeater runat=server ID=storesRep DataSourceID=storeSqlDataSource OnItemDataBound=StoresRep_ItemDataBound> <ItemTemplate>
I have a form with some controls (extJs and ASP) like this: <ext:ComboBox ID=Countries
in a ASP.net C# application I have a Checkbox with a custom css. the
I have an ASP.NET login control on a page, with the Remember Me checkbox
I use consomcontrols.grid on asp.net.I have a width problem specially on IE on page.

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.