Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
the code worked when i created a new web form again. but when i added other codes for file
uploading it doesnt work anymore. it seems that the code does not work if add other codes in
the web form ???
 

for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox chkDelete = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("chkSelect");
if (chkDelete != null)
{
 
if (chkDelete.Checked)
{
strID = GridView1.Rows[i].Cells[1].Text;
idCollection.Add(strID);
}
}
}
 

<Columns>
                       <asp:TemplateField>
                       <ItemTemplate>
              <asp:CheckBox ID="chkSelect" runat="server" />
             </ItemTemplate>
 
                       </asp:TemplateField>
                   </Columns>
Posted 16-Feb-13 2:38am
Comments
Shahriar Iqbal Chowdhury/Galib at 16-Feb-13 8:47am
   
It seems you didn't post full code of gridview, Pls post your full gridview code.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

this will be helpful, try this
for (int i = 0; i < GridView1.Rows.Count; i++)
{
     CheckBox chkDelete = (CheckBox)GridView1.Rows[i].FindControl("chkSelect");
     
     if (chkDelete != null)
     {
          if (chkDelete.Checked)
          {
               Label myLabel = (Label)GridView1.Rows[i].FindControl("TEXT_CONTROL_ID");
               idCollection.Add(myLabel.Text);
          }
     }
}
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 840
1 OriginalGriff 437
2 Abhinav S 303
3 thatraja 215
4 Emre Ataseven 200
0 Sergey Alexandrovich Kryukov 8,122
1 OriginalGriff 4,520
2 Peter Leow 3,744
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 16 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid