开发者

Usage of checkbox to retrive the multiple dataitems in Datagrid inASP.NET C#

     protected void Button1_Cl开发者_高级运维ick(object sender, EventArgs e)
  {
   foreach (DataGridItem di in GridView1.Items)
   {
       HtmlInputCheckBox chkBx = (HtmlInputCheckBox)di.FindControl("CheckBox1");
       if (chkBx != null && chkBx.Checked)
       {
          //What should I write to get the Items of that checked row.

       }
     }

   }

Help me how to retrieve the row items of the each checked row.

I tried like this but its not appending anything to the label

      foreach (GridViewRow di in GridView1.Rows)
   {
       HtmlInputCheckBox chkBx = (HtmlInputCheckBox)di.FindControl("CheckBox1");
       if ( chkBx != null && chkBx.Checked)
       {
           FID[j] += di.Cells[2].Text;
           j++;

           Label1.Text += di.Cells[2].Text;

            }

       }


It should Rows instead Items

foreach (GridViewRow di in GridView1.Rows)
{
   HtmlInputCheckBox chkBx = (HtmlInputCheckBox)di.FindControl("CheckBox1");
   if (chkBx != null && chkBx.Checked)
   {
      //What should I write to get the Items of that checked row.

   }
 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜