or
| <telerik:RadGrid ID="RadFeedsList" |
| DataSourceID="SqlDataSource2" |
| AllowMultiRowSelection="True" |
| runat="server" |
| AllowSorting="True" |
| GridLines="None" |
| Width="300px" |
| CssClass="FeedsList" |
| AutoGenerateColumns="False" |
| Skin=""> |
| <MasterTableView Width="100%"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridClientSelectColumn SortExpression="CategoryID" UniqueName="ClientSelectColumn" ItemStyle-Width="10px" /> |
| <telerik:GridBoundColumn DataField="CategoryID" UniqueName="id" Visible="false" HeaderText="Feeds"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Feeds"></telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| <ClientSettings> |
| <Selecting EnableDragToSelectRows="true" AllowRowSelect="True"></Selecting> |
| </ClientSettings> |
| <SelectedItemStyle CssClass="SelectedItem"></SelectedItemStyle> |
| <AlternatingItemStyle CssClass="" ></AlternatingItemStyle> |
| </telerik:RadGrid> |
And here is the code that I am trying to get to work:
| GridSortExpression expression = new GridSortExpression(); |
| expression.FieldName = "CategoryID"; |
| expression.SetSortOrder("Ascending"); |
| RadFeedsList.MasterTableView.SortExpressions.AddSortExpression(expression); |
| RadFeedsList.MasterTableView.Rebind(); |
But it clears all the checkboxes on the rebind/
Code behind:
| Protected Sub grdFacilities_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles grdFacilities.ItemCommand |
| If e.CommandName = "RowClick" Then |
| Dim id As Integer = Int32.Parse(e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ID")) |
| lblStatus.Text = "Selected Facility ID " & id |
| Else |
| lblStatus.Text = "e.CommandName = " & e.CommandName |
| End If |
| End Sub |
ASPX grid code:
| <telerik:RadGrid ID="grdFacilities" runat="server" GridLines="None" DataSourceID="FacilitiesGridObjectDataSource" |
| OnItemDeleted="grdFacilities_ItemDeleted" OnItemInserted="grdFacilities_ItemInserted" OnItemUpdated="grdFacilities_ItemUpdated" OnItemCommand="grdFacilities_ItemCommand" |
| AllowMultiRowEdit="True" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" > |
| <MasterTableView DataKeyNames="ID" AutoGenerateColumns="False" DataSourceID="FacilitiesGridObjectDataSource" EditMode="PopUp" |
| CommandItemDisplay="Top" NoMasterRecordsText="No facilities on file" > |
| <Columns> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton"> |
| <ItemStyle CssClass="MyImageButton" /></telerik:GridEditCommandColumn> |
| <telerik:GridBoundColumn DataField="ID" ReadOnly="True" HeaderText="ID" DataType="System.Int32" UniqueName="ID"> |
| <ItemStyle ForeColor="Gray" /></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="FacilityName" ReadOnly="True" HeaderText="Facility" UniqueName="FacilityName" ></telerik:GridBoundColumn> |
| <telerik:GridButtonColumn ConfirmText="Delete this Facility?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" |
| CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> |
| <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /></telerik:GridButtonColumn> |
| </Columns> |
| <EditFormSettings EditFormType="Template" PopUpSettings-Width="587px"> |
| <FormTemplate> |
| <table id="Table7" cellspacing="1" cellpadding="1" width="350" border="0"><tr><td>Name</td> |
| <td><asp:TextBox ID="txtFirstName" runat="server" Text='<%# Bind( "FacilityName" ) %>'></asp:TextBox></td></tr> |
| </table> |
| <asp:ImageButton ID="btnUpdate" runat="server" |
| ImageUrl="images/saveBtnBg.gif" CommandName='<%# IIf( DataBinder.Eval(Container, "OwnerTableView.IsItemInserted"), "PerformInsert", "Update") %>'> |
| </asp:ImageButton> |
| <asp:ImageButton ID="btnCancel" runat="server" |
| ImageUrl="images/cancelBtnBg.gif" CommandName="Cancel"></asp:ImageButton> |
| </FormTemplate> |
| <EditColumn UniqueName="EditCommandColumn1"> |
| </EditColumn> |
| <FormCaptionStyle BorderColor="White" BorderStyle="None" ForeColor="Black" /></EditFormSettings> |
| <CommandItemSettings AddNewRecordText="Add Facility" /> |
| </MasterTableView> |
| <HeaderContextMenu EnableTheming="True" Skin="Vista"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </HeaderContextMenu> |
| <ClientSettings enablepostbackonrowclick="true"> |
| <Selecting AllowRowSelect="true" /> |
| <Scrolling AllowScroll="True" ScrollHeight="40%" UseStaticHeaders="True" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
Hi
I have a grid with 2 tables hierarchy
System autogenerates <telerik:GridExpandColumn> columm. How I can remove it?
When I try to add ExpandCollapseColumn-Visible="false" for MasterTableView - no changes. Other properties works (for example ExpandCollapseColumn-ButtonType="ImageButton")
How I can remove this column?
(I wish to add expanding features to whole row)
When I try to add <telerik:GridExpandColumn></telerik:GridExpandColumn> System generates 2 expand columns
Current test grid is here:
| <telerik:RadGrid ID="rgAttachmentsGrid" AllowPaging="False" runat="server" Skin="CommonGrid" EnableEmbeddedSkins="false" BorderStyle="Solid" GridLines="None" AutoGenerateColumns="false" CellPadding="0" CellSpacing="0" | |
| OnItemCreated="rgAttachmentsGrid_ItemCreated" OnItemCommand="rgAttachmentsGrid_ItemCommand" > | |
| <MasterTableView DataKeyNames="AttGroupID" DataMember="Group" AutoGenerateColumns="False" EditMode="InPlace" InsertItemDisplay="Top" CommandItemDisplay="Top" AllowAutomaticInserts="true" BorderStyle="None" CellPadding="0" CellSpacing="0" | |
| ExpandCollapseColumn-Visible="false" > | |
| <CommandItemSettings AddNewRecordText="<%$ Language:Translate:str_Field_Editor_AddNewItem %>" RefreshText="<%$ Language:Translate:str_Field_Editor_Refresh %>" /> | |
| <DetailTables> | |
| <telerik:GridTableView DataKeyNames="AttachID" DataMember="Attachment" AutoGenerateColumns="false"> | |
| <ParentTableRelation> | |
| <telerik:GridRelationFields DetailKeyField="AttGroupID" MasterKeyField="AttGroupID" /> | |
| </ParentTableRelation> | |
| <Columns> | |
| <telerik:GridBoundColumn DataField="FileName" UniqueName="ID1" Visible="True" > | |
| </telerik:GridBoundColumn> | |
| </Columns> | |
| </telerik:GridTableView> | |
| </DetailTables> | |
| <Columns> | |
| <telerik:GridBoundColumn DataField="AttGroupID" UniqueName="ID" Visible="False" > | |
| </telerik:GridBoundColumn> | |
| <telerik:GridTemplateColumn> | |
| <ItemTemplate> | |
| <asp:LinkButton ID="lbGroup" runat="server" Width="100%"></asp:LinkButton> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| </Columns> | |
| </MasterTableView> | |
| </telerik:RadGrid> |