I bind the datatable in gridview in this grid view checkbox also have
if any check box is selected then get the cell value of the check box selected row i use some methods but not working
protected void btnUpdate_Click(object sender, EventArgs e)
{
{
TextBox TextBox1 = new TextBox();
foreach (GridViewRow gr in GridView1.Rows)
{
bool isChecked = ((CheckBox)gr.FindControl("chkBxSelect")).Checked;
if (isChecked)
{
//first method
string myvalue = GridView1.Rows[1].Cells[1].ToString();
// second method
GridViewRow row = GridView1.SelectedRow;
TextBox1.Text = row.Cells[0].Text;
try
{
// dt1.Rows.Add(Convert.ToString(GridView1.Cells[1].Text), "", "", "", "");
}
catch (Exception ex)
{
continue;
}
}
}
foreach (GridViewRow gr in GridView1.Rows)
{
bool isChecked = ((CheckBox)gr.FindControl("chkBxSelect")).Checked;
if (isChecked)
{
//first method
string myvalue = GridView1.Rows[1].Cells[1].ToString();
// second method
GridViewRow row = GridView1.SelectedRow;
TextBox1.Text = row.Cells[0].Text;
try
{
// dt1.Rows.Add(Convert.ToString(GridView1.Cells[1].Text), "", "", "", "");
}
catch (Exception ex)
{
continue;
}
}
}
}
how to get the value


Anil JhaRank #1,988 · 733 reputationPosted Aug 8, 2017, 11:45 PM EDT
Midhun TpRank #388 · 6.5K reputationPosted Aug 9, 2017, 1:13 AM EDT