Reputation: 13
When i click on select button in button data fill on form with specific ID but i set form disabled i mean no field is editable because i want user to click on Edit button than Data in form is enabled and user can Edit. But when click on Edit Button its Clear all fields
Please Help me i am stuck
this is my Edit button Code
protected void btnEDIT_Click(object sender, EventArgs e)
{
txt_ID.Enabled = false;
TextBoxPN.Enabled = true;
TextBoxCP.Enabled = true;
TextBoxCUR.Enabled = true;
TextBoxMIN.Enabled = true;
Catogary_drop.Enabled = true;
Vnder_Drop.Enabled = true;
Sattus_Drop.Enabled = true;
TextBoxRMKS.Enabled = true;
btnADD.Enabled = false;
btnCLSE.Enabled = true;
btnCNCL.Enabled = true;
btnEDIT.Enabled = false;
btnUPD.Enabled = true;
}
And this is my Gridiew Select Index code
protected void GridViewitem_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = GridViewitem.SelectedRow;
txt_ID.Text = row.Cells[1].Text;
TextBoxPN.Text=row.Cells[2].Text;
TextBoxCP.Text=row.Cells[3].Text;
TextBoxCUR.Text=row.Cells[4].Text;
TextBoxMIN.Text=row.Cells[5].Text;
Catogary_drop.Text = row.Cells[6].Text;
Vnder_Drop.Text = row.Cells[7].Text;
Sattus_Drop.Text = row.Cells[8].Text;
TextBoxRMKS.Text=row.Cells[9].Text;
txt_ID.Enabled = false;
TextBoxPN.Enabled = false;
TextBoxCP.Enabled = false;
TextBoxCUR.Enabled = false;
TextBoxMIN.Enabled = false;
Catogary_drop.Enabled = false;
Vnder_Drop.Enabled = false;
Sattus_Drop.Enabled = false;
TextBoxRMKS.Enabled = false;
btnADD.Enabled = false;
btnCLSE.Enabled = true;
btnCNCL.Enabled = true;
btnEDIT.Enabled = true;
btnUPD.Enabled = false;
}
Upvotes: 0
Views: 245
Reputation: 981
IsPostback check in Page_Load event may help you. Or You need to disable the postback on your edit button click.
Upvotes: 1