This is a migrated thread and some comments may be shown as answers.

radGrid with formview inside templatecolumn bind error

2 Answers 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Morgan
Top achievements
Rank 2
Morgan asked on 02 Jul 2012, 05:33 AM
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??

2 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 04 Jul 2012, 12:47 PM
Hi,

 Is this issue also reproduced without having any update panels on the page? You can try to explicitly change the mode of the formView when there are records that have to be shown. If the problem persists we will appreciate if you can send a sample runnable page that replicates the issue so we can check it on our side

Greetings,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Morgan
Top achievements
Rank 2
answered on 17 Jul 2012, 04:30 AM
Hi - thanks for the response but I was able to correct the error by first setting the state of the formview control to readonly in code behind. Not sure where the problem lies, but it must be a mode issue on the formview.

thanks.
Tags
Grid
Asked by
Morgan
Top achievements
Rank 2
Answers by
Marin
Telerik team
Morgan
Top achievements
Rank 2
Share this question
or