Hi together,
I have a question about the RadGrid. I have now created a RadGrid with a Edit, Delete and Add new Record Button. The Edit Mask shows fine, but if I Edit a record it dosn't update it. When I debug I see that it doesnt't run my Update Method in my Code.
Below my apsx and my methods.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="radGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="radGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="RadioButton1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> <telerik:AjaxUpdatedControl ControlID="RadioButton2" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="RadioButton2"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> <telerik:AjaxUpdatedControl ControlID="RadioButton1" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="CheckBox1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="25"> <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border: 0;" /> </telerik:RadAjaxLoadingPanel> <telerik:RadGrid ID="radGrid1" AutoGenerateEditColumn="True" DataSourceID="objectDataSource1" runat="server" GridLines="None" Skin="Office2010Blue"> <MasterTableView AllowAutomaticUpdates="True" AllowAutomaticInserts="True" CommandItemDisplay="Top" DataSourceID="ObjectDataSource1"> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"> <ItemStyle CssClass="MyImageButton" /> </telerik:GridEditCommandColumn> <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> </telerik:GridButtonColumn> </Columns> <EditFormSettings ColumnNumber="2" CaptionDataField="Address" CaptionFormatString="Edit properties of Address Case Relations"> <FormTableItemStyle Wrap="False"></FormTableItemStyle> <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle> <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White" Width="100%" /> <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" /> <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle> <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record" UniqueName="EditCommandColumn1" CancelText="Cancel edit"/> <FormTableItemStyle Wrap="False"></FormTableItemStyle> <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle> <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White" Width="100%" /> <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" /> <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle> <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record" UniqueName="EditCommandColumn1" CancelText="Cancel edit"> </EditColumn> <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle> <PopUpSettings ScrollBars="None" /> </EditFormSettings> <RowIndicatorColumn Visible="False"> <HeaderStyle Width="20px" /> </RowIndicatorColumn> <ExpandCollapseColumn Resizable="False" Visible="False"> <HeaderStyle Width="20px" /> </ExpandCollapseColumn> </MasterTableView> </telerik:RadGrid> <asp:ObjectDataSource ID="objectDataSource1" TypeName="ESTV.A3.Logic.AddressCaseRelationBll" SelectMethod="Select" UpdateMethod="Update" InsertMethod="Insert" DeleteMethod="Delete" runat="server" OldValuesParameterFormatString="original_{0}"> <SelectParameters> <asp:QueryStringParameter Name="addressId" Type="String" Direction="Input" QueryStringField="id"> </asp:QueryStringParameter> </SelectParameters> <UpdateParameters> <asp:Parameter Name="id" Type="String" /> <asp:Parameter Name="NotificationDate" Type="DateTime" /> <asp:Parameter Name="NoticeOfReceipt" Type="Boolean" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="id" Type="String" /> <asp:Parameter Name="NotificationDate" Type="DateTime" /> <asp:Parameter Name="NoticeOfReceipt" Type="Boolean" /> </InsertParameters> <DeleteParameters> <asp:Parameter Name="id" Type="String"/> </DeleteParameters> </asp:ObjectDataSource>And here my Code
public List<AddressCaseRelation> Select(string addressId) { ////TODO: validation and error handling Guid guidId = new Guid(addressId); return entityDao.GetByAddressId(guidId); } public void Update(string id, bool noticeOfReceipt, DateTime notificationDate) { Guid guidId = new Guid(id); AddressCaseRelation addressCaseRelation = entityDao.GetById(guidId); addressCaseRelation.NoticeOfReceipt = noticeOfReceipt; addressCaseRelation.NotificationDate = notificationDate; entityDao.Update(addressCaseRelation); entityDao.CommitChanges(); } public void Insert(string id, bool noticeOfReceipt, DateTime notificationDate) { Guid guidId = new Guid(id); AddressCaseRelation addressCaseRelation = entityDao.GetById(guidId); addressCaseRelation.NoticeOfReceipt = noticeOfReceipt; addressCaseRelation.NotificationDate = notificationDate; entityDao.Update(addressCaseRelation); entityDao.CommitChanges(); } public void Delete(string id) { Guid guidId = new Guid(id); AddressCaseRelation addressCaseRelation = entityDao.GetById(guidId); entityDao.Delete(addressCaseRelation); entityDao.CommitChanges(); }I have also the same problem if i click the Add new Record Button, the form doesnt appear. What is here wrong?
Regards and thanks