I have an issue with formviews being nested inside the templatecolumn of a radGrid and the whole thing is wrapped in an updatepanel.
A dropdown list refreshes data inside the template columns on index changed, and performs a databind on each formview found in each row.
If the dataitemcount of the formview is 0 it goes to insert which works fine.
The problem is when changing the mode to insert on the formview, it will NOT go back to readonly mode even when there is data. I'm getting double ups in the database from users thinking there's no data. I'm getting no errors reported by the system. It just won't pick up the dataitemcount going to 1.
I can force it to readonly in the script, but I can't get it to changemode using dataitemcount any more.
I'm doing the formview refresh using the following code contained in a dropdown_selectedindexchanged function.
foreach (GridDataItem ri in RadGrid1.Items)
{
Label Label1 = (Label)ri.FindControl("Label1");
Label1.Text = DropDownList2.SelectedItem.Text;
FormView fw1 = (FormView)ri.FindControl("fw1");
fw1.DataBind();
if (fw1.DataItemCount> 0)
{
}
else
{
fw1.ChangeMode(FormViewMode.Insert);
}
UpdatePanel1.update();
}
any ideas how I can get it to change back??
A dropdown list refreshes data inside the template columns on index changed, and performs a databind on each formview found in each row.
If the dataitemcount of the formview is 0 it goes to insert which works fine.
The problem is when changing the mode to insert on the formview, it will NOT go back to readonly mode even when there is data. I'm getting double ups in the database from users thinking there's no data. I'm getting no errors reported by the system. It just won't pick up the dataitemcount going to 1.
I can force it to readonly in the script, but I can't get it to changemode using dataitemcount any more.
I'm doing the formview refresh using the following code contained in a dropdown_selectedindexchanged function.
foreach (GridDataItem ri in RadGrid1.Items)
{
Label Label1 = (Label)ri.FindControl("Label1");
Label1.Text = DropDownList2.SelectedItem.Text;
FormView fw1 = (FormView)ri.FindControl("fw1");
fw1.DataBind();
if (fw1.DataItemCount> 0)
{
}
else
{
fw1.ChangeMode(FormViewMode.Insert);
}
UpdatePanel1.update();
any ideas how I can get it to change back??