S
sri_san
Hello,
I have a gridview in a usercontrol which is inside another
usercontrol. I am facing a problem when I click on "Update" in the
sense, inside the onRowUpdating event - the gridview.editindex is -1
and is unable to find the controls from the edittemplate. The same
flow works fine when the gridview is coded in a aspx page instead of
inside a nested usercontrol. The controls are declared in the html view
and is not dynamic.
The code is outlined as below:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
bindData();
}
}
protected void newsGridView_RowEditing(object sender,
GridViewEditEventArgs e)
{
newsGridView.EditIndex = e.NewEditIndex;
bindData();
}
protected void newsGridView_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
// In here, the gv.editIndex is reset to -1 with
gv.Rows.Count =0.
TextBox txtInput =
(TextBox)(gvStudents.Rows[e.RowIndex].FindControl("txtInput"))).Text);
}
The intriguing part is the same code works fine on a aspx page.
Any help would be appreciated!
Thanks,
Sam
I have a gridview in a usercontrol which is inside another
usercontrol. I am facing a problem when I click on "Update" in the
sense, inside the onRowUpdating event - the gridview.editindex is -1
and is unable to find the controls from the edittemplate. The same
flow works fine when the gridview is coded in a aspx page instead of
inside a nested usercontrol. The controls are declared in the html view
and is not dynamic.
The code is outlined as below:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
bindData();
}
}
protected void newsGridView_RowEditing(object sender,
GridViewEditEventArgs e)
{
newsGridView.EditIndex = e.NewEditIndex;
bindData();
}
protected void newsGridView_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
// In here, the gv.editIndex is reset to -1 with
gv.Rows.Count =0.
TextBox txtInput =
(TextBox)(gvStudents.Rows[e.RowIndex].FindControl("txtInput"))).Text);
}
The intriguing part is the same code works fine on a aspx page.
Any help would be appreciated!
Thanks,
Sam