I would like to Disable the Textbox in Gridview , if the textbox is not null...
I wrote the below coding in the RowEditing Event but its not working.
gvAssginingView.EditIndex = e.NewEditIndex;
TextBox TxtVal = (TextBox)gvAssginingView.Rows[e.NewEditIndex].FindControl("txtDriverCode");
TxtVal.Enabled = false;
Can Anyone Guide me ...
Thanks in advance
Karthik.k

rajesh chincholkarPosted Oct 28, 2013, 12:32 PM
BindEmployeeDetails();
TextBox txt_FName = (TextBox)gvDetails.Rows[e.NewEditIndex].FindControl("txt_FName");
txt_FName.Visible = false;
Sanjeeb LenkaPosted Aug 30, 2013, 7:36 AM
try like this. it may work.
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
gvAssginingView.EditIndex = e.NewEditIndex;
gridbind();
TextBox TxtVal = (TextBox)gvAssginingView.Rows[e.NewEditIndex].FindControl("txtDriverCode");
if (TxtVal.Text != string.Empty)
{
TxtVal.Enabled = false;
}
else
{
TxtVal.Enabled = true;
}
}
Joxin StanlyPosted Aug 30, 2013, 7:28 AM
http://onetidbit.wordpress.com/2009/05/04/disabling-some-of-the-textboxes-in-gridview-edit/
similiar to what you did..
hope this helps !!