I have 1 gridview. and every row is editable and after checkbox checked i want to enable textbox otherwise this textbox is disable. How to do this...
thanks in advance
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Feb 7, 2012, 10:48 PM
you can also use java script/ Jquery to disable textbox.
$(
"#SeasonId").attr("disabled", "disabled");Deepak SharmaPosted Feb 7, 2012, 5:40 AM
protected void CheckBox1_OnCheckedChanged(object sender, EventArgs e)
{
for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox cb = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox1");
TextBox txt = (TextBox)GridView1.Rows[i].Cells[0].FindControl("TextBox1");
if (cb.Checked)
{
txt.Enabled = true;
}
else
{
txt.Enabled = false;
}
}
}