<telerik:RadAjaxManager ID="ajaxManager" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1" onajaxrequest="ajaxManager_AjaxRequest" UpdatePanelsRenderMode="Inline"> <ClientEvents OnRequestStart="centerLoadingPanel"></ClientEvents> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="ajaxManager"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="infoBar" /> <telerik:AjaxUpdatedControl ControlID="errorPanel" /> <telerik:AjaxUpdatedControl ControlID="contentScreenPanel" /> <telerik:AjaxUpdatedControl ControlID="tabStrip" /> <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="errorPanel"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="errorLabel" /> <telerik:AjaxUpdatedControl ControlID="editMode" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="infoBar"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="screenOverviewPanel" /> <telerik:AjaxUpdatedControl ControlID="toolBarPanel" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="ToolBarControl1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="contentScreenPanel" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="screenOverviewPanel"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="lblScreenTitle" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager><telerik:RadPane runat="Server" ID="lowerContentPane" Scrolling="Both" Width="100%" Height="542"> <asp:Panel ID="errorPanel" runat="server"> <asp:Label ID="errorLabel" ForeColor="Red" runat="server"></asp:Label> <asp:HiddenField runat="server" ID="editMode" /> </asp:Panel> <asp:Panel ID="contentScreenPanel" runat="server"></asp:Panel> </telerik:RadPane>public Dictionary<string, object> GetAllUsersGrid(int startRowIndex, int maximumRows, List<GridSortExpression> sortExpression, List<GridFilterExpression> filterExpression)Hello.
I use RadGrid and ObjectDataSource (ods) to fill the grid with data.
I used to make insert, update and delete from code behind (using RadGrid events: UpdateCommand, DeleteCommand , etc) - so, i used to create my objects using FindControl(string id) and then manipulate with them.
Now, I decide to do this using ods, but i cannot work it out while i have nested objects.
(in case of single object it works fine - i mean if i Insert, Update or Delete only Person class - see below)
Here is my example:
class User{ class Person{ int ID int ID; int PersonID; string FirstName; string UserName; string LastName; } }My ods methods are:
SelectMethod: iList<User> GetUsers(); InsertMethod, UpdateMethod: void SaveUser(User u); DeleteMethod: void DeleteUser(User u);In my EditFormTemplate i bind these like this (binding works fine):
<telerik:RadTextBox ID="txtUserName" runat="server" Text='<%# Bind("UserName") %>'/> <telerik:RadTextBox ID="txtFirstName" runat="server" Text= '<%# DataBinder.Eval(Container.DataItem, "Person.FirstName") %>' /> <telerik:RadTextBox ID="txtLastName" runat="server" Text= '<%# DataBinder.Eval(Container.DataItem, "Person.LastName") %>' />So, when i am trying to update user object, updates only UserName, update does not cause to FirstName and LastName (User.Person properties). I guess ods cannot recognize them at all...
Is there any solution for this?
Or is there any alternative way to act situations lake this?
P.S. the same problem is when i use LinqDataSource
thanks.
protected void BuildOptions(GridEditFormItem editFormItem){ RadComboBox dd_RptID = (RadComboBox)editFormItem.FindControl("dd_RptID"); EISDataContext db = new EISDataContext(); // get the unique report options for the current selected report so we can render the correct controls var q_options = (from options in db.tReportConfigs where options.RptID == dd_RptID.SelectedItem.Value select options.OptID).Distinct(); foreach (var option in q_options) { string optionType = (from options in db.tReportOptions where options.OptID == option select options.OptTyp).FirstOrDefault(); string optionName = (from options in db.tReportOptions where options.OptID == option select options.OptNm).FirstOrDefault(); // get the option values for this option var q_optionValues = from optionvalues in db.tReportConfigs where optionvalues.RptID == dd_RptID.SelectedItem.Value && optionvalues.OptID == option select optionvalues; // create a div for the option control and populate it with the correct control Panel panelContent = new Panel(); panelContent.Attributes.Add("class", "popupcontent"); if (optionType == "ComboBox") { RadComboBox combo = new RadComboBox(); combo.ID = "dd_" + option.ToString(); foreach (var optionValue in q_optionValues) { combo.Items.Add(new RadComboBoxItem(optionValue.tReportOptionValue.OptNm, optionValue.tReportOptionValue.OptVal)); } panelContent.Controls.Add(combo); } // create a div for the option title and populate it with the option name Panel panelTitle = new Panel(); panelTitle.Attributes.Add("class", "popuptitle"); Label pnlLabel = new Label(); pnlLabel.Text = optionName; panelTitle.Controls.Add(pnlLabel); // create a div for the clear control Panel panelClear = new Panel(); panelClear.Attributes.Add("class", "clear"); editFormItem.FindControl("divOptions").Controls.Add(panelTitle); editFormItem.FindControl("divOptions").Controls.Add(panelContent); editFormItem.FindControl("divOptions").Controls.Add(panelClear); }}