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


Joxin Stanly181 reputationPosted Aug 30, 2013, 3:28 AM EDT
http://onetidbit.wordpress.com/2009/05/04/disabling-some-of-the-textboxes-in-gridview-edit/
similiar to what you did..
hope this helps !!
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 30, 2013, 3:36 AM EDT
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;
}
}
rajesh chincholkar11 reputationPosted Oct 28, 2013, 8:32 AM EDT
BindEmployeeDetails();
TextBox txt_FName = (TextBox)gvDetails.Rows[e.NewEditIndex].FindControl("txt_FName");
txt_FName.Visible = false;