Hello!
I have a radgrid with a detailtable that is preloaded and expanded at the clientside.
If I switch to editmode, The detailtable is lost but the row is expanded - the expanded symbol is there but no table underneath.
Here is the aspx code:
and heres the databinding source:
Thx in advance & kind regards
I have a radgrid with a detailtable that is preloaded and expanded at the clientside.
If I switch to editmode, The detailtable is lost but the row is expanded - the expanded symbol is there but no table underneath.
Here is the aspx code:
| <telerik:RadGrid ID="rgFiles" runat="server" |
| Skin="Office2007" |
| AllowAutomaticDeletes="false" |
| meta:resourcekey="radGrid" |
| AllowAutomaticInserts="false" |
| AllowAutomaticUpdates="false" |
| AllowMultiRowEdit="false" |
| AllowMultiRowSelection="false" |
| AllowSorting="true" |
| AllowPaging="true" |
| PageSize="10" |
| OnNeedDataSource="rgFiles_NeedDataSource" |
| OnDeleteCommand="rgFiles_Delete" |
| OnItemCommand="rgFiles_ItemCommand" |
| OnDetailTableDataBind="rgFiles_DetailTableDataBind" |
| AutoGenerateColumns="false"> |
| <PagerStyle Mode="NumericPages" /> |
| <ClientSettings> |
| <Selecting AllowRowSelect="true" /> |
| </ClientSettings> |
| <MasterTableView DataKeyNames="Id" HierarchyLoadMode="Client" EditMode="InPlace"> |
| <Columns> |
| <telerik:GridButtonColumn |
| ButtonType="ImageButton" |
| UniqueName="Download" |
| CommandName="ItemCommand" |
| ImageUrl="~/Img/Type.gif" |
| CommandArgument="download"> |
| </telerik:GridButtonColumn> |
| <telerik:GridBoundColumn meta:resourcekey="colFilename" ReadOnly="true" |
| UniqueName="Filename" DataField="Filename" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn ReadOnly="true" |
| Visible="false" UniqueName="Mimetype" DataField="Mimetype" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn meta:resourcekey="colSize" ReadOnly="true" |
| UniqueName="Size" DataField="Size" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn meta:resourcekey="colCreateDate" ReadOnly="true" |
| UniqueName="CreationDate" DataField="CreationDate" > |
| </telerik:GridBoundColumn> |
| <telerik:GridButtonColumn |
| meta:resourcekey="colDelete" |
| UniqueName="DeleteColumn" |
| CommandName="Delete" |
| ButtonType="ImageButton" |
| ImageurL="~/Img/delete.gif" |
| Display="false"> |
| </telerik:GridButtonColumn> |
| </Columns> |
| <DetailTables> |
| <telerik:GridTableView Name="Keywords" |
| EditMode="InPlace" |
| ShowFooter="False" |
| meta:resourcekey="detailtable"> |
| <columns> |
| <telerik:GridTemplateColumn UniqueName="colKeywords"> |
| <HeaderStyle Width="200px"></HeaderStyle> |
| <HeaderTemplate> |
| <asp:Label meta:resourcekey="lblHeadKeywords" ID="lblHeadKeywords" runat="server" ></asp:Label> |
| </HeaderTemplate> |
| <ItemTemplate> |
| <p> |
| <asp:Label meta:resourcekey="lblKeywords" ID="lblKeywords" |
| runat="server" Text='<%# Eval("SearchField") %>' Width="100%"> |
| </asp:Label> |
| </p> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <p> |
| <asp:TextBox ID="txtKeywords" runat="server" Text='<%# Eval("SearchField") %>' TextMode="MultiLine" > |
| </asp:TextBox> |
| </p> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridEditCommandColumn FooterText="EditCommand footer" |
| UniqueName="EditCommandColumn" HeaderText="Edit Command Column"> |
| </telerik:GridEditCommandColumn> |
| </columns> |
| </telerik:GridTableView> |
| </DetailTables> |
| </MasterTableView> |
| </telerik:RadGrid> |
and heres the databinding source:
| protected void rgFiles_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) |
| { |
| if (this.files == null) |
| { |
| if (this.NeedDataSource != null) |
| { |
| AddFileEventArgs afea = new AddFileEventArgs(); |
| afea.FileOwnerId = this.OwnerId; |
| this.NeedDataSource(this, afea); |
| this.files = afea.Files; |
| } |
| } |
| if (sender is RadGrid) |
| { |
| (sender as RadGrid).DataSource = this.files; |
| } |
| } |
| protected void rgFiles_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e) |
| { |
| ICollection<IPortalFile> coll = null; |
| if (rgFiles.DataSource != null) |
| { |
| coll = rgFiles.DataSource as ICollection<IPortalFile>; |
| } |
| if (coll == null && this.files != null) |
| { |
| coll = this.files; |
| } |
| if (coll == null) |
| return; |
| string id = (string) e.DetailTableView.ParentItem.GetDataKeyValue("Id"); |
| foreach (IPortalFile file in coll) |
| { |
| if (file.Id.Equals(id)) |
| { |
| e.DetailTableView.DataSource = new IPortalFile[]{ file }; |
| } |
| } |
| } |
| protected void OnPreRender(object sender, EventArgs e) |
| { |
| this.DataBind(); |
| if (this.enabled) |
| { |
| this.btnAddFile.CssClass = CSS_ENABLED; |
| this.rgFiles.Columns[this.rgFiles.Columns.Count - 1].Display = true; |
| } |
| else |
| { |
| this.btnAddFile.CssClass = CSS_DISABLED; |
| this.rgFiles.Columns[this.rgFiles.Columns.Count - 1].Display = false; |
| } |
| this.rgFiles.Rebind(); |
| } |
Thx in advance & kind regards