
Grid with nested view is reporting the following error when I execute the Insert or Edit command. Without the nested view, Insert and Edit works fine in grdEntities. The nested view portion works fine right now as is(including the user control assocaited with the grdEndorsements). What happens is that when I issue the Insert Command from the grdEntities header or an Edit command from one of the rows in the grdEntities mastertable, I get the following error:
The DataSourceID of 'grdEndorsements' must be the ID of a control of type IDataSource. A control with ID 'SDSGetEndorsements' could not be found.
Here is the code:
| <telerik:RadGrid ID="grdEntities" runat="server" Skin="Telerik" |
| GridLines="None" AllowPaging="True" AllowSorting="True" Width="99%" AutoGenerateColumns="False" |
| ShowStatusBar="True" Visible ="true" ShowFooter="True" AllowMultiRowEdit="true"> |
| <MasterTableView GridLines="None" Width="100%" CommandItemDisplay="Top" |
| DataKeyNames="EntityID" NoMasterRecordsText="No Entities to Display." > |
| <NestedViewTemplate> |
| <asp:Label ID="LabelEntityID" Font-Bold="true" Font-Italic="true" Text='<%# Eval("EntityID") %>' |
| Visible="false" runat="server" /> |
| <telerik:RadGrid ID="grdEndorsements" runat="server" Skin="Telerik" |
| GridLines="None" AllowPaging="True" AllowSorting="True" Width="99%" AutoGenerateColumns="False" |
| ShowStatusBar="True" Visible ="true" ShowFooter="True" DataSourceID="SDSGetEndorsements"> |
| <MasterTableView GridLines="None" Width="100%" CommandItemDisplay="Top" HierarchyLoadMode="ServerOnDemand" |
| DataKeyNames="EndorsementID" NoMasterRecordsText="No Endorsements to Display." PageSize="5"> |
| <CommandItemSettings AddNewRecordText="Add New Endorsement" /> |
| <Columns> |
| <telerik:GridEditCommandColumn> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridBoundColumn UniqueName="EndorsementID" HeaderText="EndorsementID" DataField="EndorsementID" Visible="False" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EntityID" HeaderText="EntityID" DataField="EntityID" Visible="False" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EndorsementName" HeaderText="Name" DataField="EndorsementName" Visible="True" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EndorsementTitle" HeaderText="Title" DataField="EndorsementTitle"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EndorsementSSN" HeaderText="SSN" DataField="EndorsementDate"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EndorsementDate" HeaderText="Date Endorsed" DataField="EndorsementDate"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| <EditFormSettings UserControlName="~/UserControls/AddEditEndorsement.ascx" EditFormType="WebUserControl"> |
| <EditColumn UniqueName="EditCommandColumnE1"> |
| </EditColumn> |
| </EditFormSettings> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| </MasterTableView> |
| <ClientSettings> |
| <Scrolling AllowScroll="False" /> |
| </ClientSettings> |
| <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="True" /> |
| <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" /> |
| <AlternatingItemStyle HorizontalAlign="Left" VerticalAlign="Middle" /> |
| </telerik:RadGrid> |
| <asp:SqlDataSource ID="SDSGetEndorsements" runat="server" |
| ConnectionString="<%$ ConnectionStrings:ConnectionString %>" |
| SelectCommand="SELECT * FROM [OldEndorsements] WHERE ([EntityID] = @EntityID)"> |
| <SelectParameters> |
| <asp:ControlParameter ControlID="LabelEntityID" PropertyName="Text" Type="String" Name="EntityID" /> |
| </SelectParameters> |
| </asp:SqlDataSource> |
| </NestedViewTemplate> |
| <CommandItemSettings AddNewRecordText="Add New Entity" /> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridEditCommandColumn> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridBoundColumn UniqueName="EntityID" HeaderText="EntityID" DataField="EntityID" Visible="False" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EntityType" HeaderText="EntityType" DataField="EntityType" Visible="False" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EntityName" HeaderText="Name" DataField="EntityName" Visible="True" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EntityAddress" HeaderText="Address" DataField="EntityAddress"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EntityAddress2" HeaderText="Address2" DataField="EntityAddress2"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EntityCity" HeaderText="City" DataField="EntityCity"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EntityState" HeaderText="State" DataField="EntityState"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EntityZip" HeaderText="Zip" DataField="EntityZip"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EntityTaxID" HeaderText="Tax ID" DataField="EntityTaxID"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="EntityTypeDesc" HeaderText="Type" DataField="EntityTypeDesc"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| <EditFormSettings UserControlName="~/UserControls/AddEditEntity.ascx" EditFormType="WebUserControl"> |
| <EditColumn UniqueName="EditCommandColumn1"> |
| </EditColumn> |
| </EditFormSettings> |
| </MasterTableView> |
| <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" /> |
| <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="True" /> |
| </telerik:RadGrid> |
Thanks.
| function pageLoad() { |
| $('.rtChk').bind('click', function() { |
| // Check/uncheck child checkboxes |
| var parentLi = $(this).parents('.rtLI:first'); |
| if ($(this).is(':checked')) |
| $(parentLi).find('.rtChk:not(:first)').attr('checked', true); |
| else |
| $(parentLi).find('.rtChk:not(:first)').attr('checked', false); |
| // Uncheck parent checkbox on uncheck |
| var grandParentLi = $(this).parents('.rtLI:first').parents('.rtLI:first'); |
| if ($(this).is(':checked') == false) |
| $(grandParentLi).find('.rtChk:first').attr('checked', false); |
| }); |
| } |
Below is code that I have for my custom filter column. Everything works great, however, if I select
"All" from the radcombobox I get "No records to display." I am not sure if it is set up correctly to
either remove the the currentfilterfunction and value or how I set the column to no NoFilter when
"All" is chosen. Any ideas? Below is the code. Thanks is advance.
Joshua
| public class MyCustomFilteringColumn : GridBoundColumn |
| { |
| //RadGrid will call this method when it initializes the controls inside the filtering item cells |
| protected override void SetupFilterControls(TableCell cell) |
| { |
| base.SetupFilterControls(cell); |
| cell.Controls.RemoveAt(0); |
| Telerik.Web.UI.RadComboBox combo = new Telerik.Web.UI.RadComboBox(); |
| combo.ID = ("RadComboBox1" + this.UniqueName); |
| combo.ShowToggleImage = false; |
| combo.Skin = "Office2007";// "Web20"; |
| combo.EnableLoadOnDemand = true; |
| combo.AutoPostBack = true; |
| combo.MarkFirstMatch = true; |
| combo.Height = Unit.Pixel(100); |
| combo.Width = Unit.Pixel(60); |
| combo.ItemsRequested += this.list_ItemsRequested; |
| combo.SelectedIndexChanged += this.list_SelectedIndexChanged; |
| cell.Controls.AddAt(0, combo); |
| cell.Controls.RemoveAt(1); |
| } |
| //RadGrid will cal this method when the value should be set to the filtering input control(s) |
| protected override void SetCurrentFilterValueToControl(TableCell cell) |
| { |
| base.SetCurrentFilterValueToControl(cell); |
| RadComboBox combo = (RadComboBox)cell.Controls[0]; |
| if ((this.CurrentFilterValue != string.Empty)) |
| { |
| combo.Text = this.CurrentFilterValue; |
| } |
| } |
| //RadGrid will call this method when the filtering value should be extracted from the filtering input control(s) |
| protected override string GetCurrentFilterValueFromControl(TableCell cell) |
| { |
| RadComboBox combo = (RadComboBox)cell.Controls[0]; |
| return combo.Text; |
| } |
| private void list_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) |
| { |
| ((RadComboBox)o).DataTextField = this.DataField; |
| ((RadComboBox)o).DataValueField = this.DataField; |
| ((RadComboBox)o).DataSourceID = Global.GridDS; |
| ((RadComboBox)o).DataBind(); |
| ((RadComboBox)o).Items.Insert(0, new RadComboBoxItem("All", "")); |
| } |
| private void list_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) |
| { |
| GridFilteringItem filterItem = (GridFilteringItem)((RadComboBox)o).NamingContainer; |
| if ((this.UniqueName == "Index")) |
| { |
| //this is filtering for integer column type |
| filterItem.FireCommandEvent("Filter", new Pair("EqualTo", this.UniqueName)); |
| } |
| //filtering for string column type |
| filterItem.FireCommandEvent("Filter", new Pair("Contains", this.UniqueName)); |
| } |
| } |