Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Contributor
4868 Points
851 Posts
May 08, 2012 05:54 AM|LINK
protected void Change(object sender, EventArgs e) { DropDownList ddl = (DropDownList)sender; GridViewRow row = (GridViewRow)ddl.Parent.Parent; int idx = row.RowIndex; DropDownList dlMng = (DropDownList)sender; TextBox txtreason = (TextBox)GridView1.Rows[idx].FindControl("txtreason"); if (dlMng.SelectedIndex == 0) { txtreason.ReadOnly = true; } if (dlMng.SelectedIndex == 1) { txtreason.ReadOnly = false; } }
cninjas
Contributor
4868 Points
851 Posts
Re: set the readonly property to textbox in gridview using dropdownlist
May 08, 2012 05:54 AM|LINK
protected void Change(object sender, EventArgs e) { DropDownList ddl = (DropDownList)sender; GridViewRow row = (GridViewRow)ddl.Parent.Parent; int idx = row.RowIndex; DropDownList dlMng = (DropDownList)sender; TextBox txtreason = (TextBox)GridView1.Rows[idx].FindControl("txtreason"); if (dlMng.SelectedIndex == 0) { txtreason.ReadOnly = true; } if (dlMng.SelectedIndex == 1) { txtreason.ReadOnly = false; } }Niranjan