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

Problem with Rebind() in DataGrid

5 Answers 222 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sathya
Top achievements
Rank 1
Sathya asked on 28 Jul 2008, 08:53 AM

void rdItemsGrid_ItemCommand(object source, GridCommandEventArgs e)

{

if (e.CommandName == "UpdateAll")

{

foreach (GridDataItem editedItem in rdItemsGrid.EditItems)

{

if (editedItem.EditFormItem.IsInEditMode)

UpdateItemPermission(editedItem.EditFormItem);

}

rdItemsGrid.Rebind();

}

else if (e.CommandName == "Update")
{
if (e.Item.IsInEditMode)
UpdateItemPermission(e.Item
as GridEditableItem);
rdItemsGrid.Rebind();
}
}

The Rebind() method which is used in Update All block works fine. But when i call the Rebind method in the Update block, which is highlighted in red, I get the following Error.

DataBinding: ' System.Data.DataRowView' does not contain a property with the name '....'

Description: An unhandled exception occured during the execution of the current web reequest.Please review the stack trace for more information about the error and from where it originated in the code.

Exception details: System.Web.HttpException :DataBinding: ' System.Data.DataRowView' does not contain a property with the name '....

Can you kindly help me in solving this issue.

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Jul 2008, 11:02 AM
Hi Sathya,

Commands like Edit, Update, Delete etc will call Rebind() implicitly, you don't have to call Rebind() explicitly. You can also refer the following help article which explains the Grid commands that call the Rebind implicitly.
Commands that invoke Rebind() implicitly

Thanks
Shinu.
0
jana
Top achievements
Rank 1
answered on 28 Jul 2008, 11:50 AM
Actually the problem is, i have a master table and  detail table. When i update the value in the detail table, the detail table values are pefectly updated. But at the same time i want the updated values to be reflected in the master table.So i tried to used this Rebind() method.

What should i do to reflect the detail table values both in the master table as well as the detail table?




0
Ricardo Pinto
Top achievements
Rank 1
answered on 11 Nov 2008, 04:05 AM
Hi Jana!

I'm having exactly the sam problem.
When I update a record in the detailtable (with an usercontrol edit form), I can update the detailtable with the following code:

 

 

If

 

(e.CommandName = RadGrid.PerformInsertCommandName) Then

 

 

 

e.Item.OwnerTableView.Rebind()

 

End

 

If

 


However if I try something similar to refresh the mastertable:

 

e.Item.OwnerTableView.ParentItem.OwnerTableView.Rebind()
or
radgrid1.MasterTableView.Rebind()

I get the following error:

Cannot unregister UpdatePanel with ID "..." since it was
not registered with the ScriptManager. This might occur if the
UpdatePanel was removed from the control tree and later added again,
which is not supported.

Did you manage to solve this issue?
Thanks in advance,

Ricardo.

0
Yavor
Telerik team
answered on 11 Nov 2008, 06:51 AM
Hi Ricardo,

This seems like a problem with the ajax settings, for example when using an AjaxManager.
If the issue persists, you can open a formal support ticket, and send us a small project, demonstrating your setup, for additional review.

Best wishes,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Joe
Top achievements
Rank 1
answered on 01 Jul 2010, 03:28 AM
I had this same issue.  I have discovered a workaround, although if there's a better solution I'd love to see it.

But to fix the issue, I just had a flag in the code behind of the page, called "RebindGrid" that i declared and initialize to false, then in the itemCommand handler I set it to true, then in the Page_PreRender event, i check it, and if true, I call RadGrid.Rebind().  that seems to do the trick.  for some reason, you just can't call it from within the ItemCommand handler, but you can call it on any other event handler in the page.
Tags
General Discussions
Asked by
Sathya
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
jana
Top achievements
Rank 1
Ricardo Pinto
Top achievements
Rank 1
Yavor
Telerik team
Joe
Top achievements
Rank 1
Share this question
or