Hi everyone,
I am trying to use the update function on gridview.
The SelectedRow function should return the current row to be
updated, however, I get "Object reference not set to an instance of an object" error. I have checked the variable names and they are correct. could please someone help me!!!
Code:
protected void gviewAccountSub_RowUpdating(object sender, GridViewUpdateEventArgs e) {
try {
GridViewRow row = gviewAccountSub.SelectedRow;
row.RowState = DataControlRowState.Edit;
DropDownList ddlCurrency = (DropDownList)row.FindControl("ddlvAccountSub_gviewCurrencyEdit");
DropDownList ddlAccount = (DropDownList)row.FindControl("ddlvAccountSub_gviewAccountEdit");
e.NewValues["Currency"] = ddlCurrency.SelectedValue;
e.NewValues["Account"] = ddlAccount.SelectedValue;
}