Friday, 25 October 2013

Gridview row having button and button click event enable disabling grid view textboxes

 protected void btnExpenseAccount_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;
            GridViewRow grv = (GridViewRow)btn.NamingContainer;
            int index = grv.RowIndex;
            TextBox txtExpenseAccount = (TextBox)grvVendorProperties.Rows[index].FindControl("txtExpenseAccount");
            TextBox txtInitialBalance = (TextBox)grvVendorProperties.Rows[index].FindControl("txtInitialBalance");
            Button btnExpenseAccount = (Button)grvVendorProperties.Rows[index].FindControl("btnExpenseAccount");
            TextBox txtEffectiveDate = (TextBox)grvVendorProperties.Rows[index].FindControl("txtEffectiveDate");
            TextBox txtReceiptAccount = (TextBox)grvVendorProperties.Rows[index].FindControl("txtReceiptAccount");
            Button btnReceiptAccount = (Button)grvVendorProperties.Rows[index].FindControl("btnReceiptAccount");
            txtExpenseAccount.Enabled = true;
            txtInitialBalance.Enabled = true;
            btnExpenseAccount.Enabled = true;
            txtEffectiveDate.Enabled = true;
            txtReceiptAccount.Enabled = true;
            btnReceiptAccount.Enabled = true;

 }

No comments:

Post a Comment