0

我有带有 Telerik 组件的菜单。但我不能使用 Telerik。我需要这个没有 Telerik 的菜单。Stackoverflow 中的另一个人建议我使用 TreeView,但不能正常工作。我不能在这里使用截图!

代码 Telerik:

        <telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" DataSourceID="dbSqlDataSource"
            GridLines="None" Skin="Windows7" Width="900px" Height="550px">
            <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            </ClientSettings>
            <GroupHeaderItemStyle HorizontalAlign="Left" />
            <MasterTableView AutoGenerateColumns="False" DataSourceID="dbSqlDataSource"
                GroupsDefaultExpanded="False">
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="sub_folder_path" FilterControlAltText="Filter sub_folder_path column"
                        HeaderText="sub_folder_path" SortExpression="sub_folder_path" UniqueName="sub_folder_path">
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                    <telerik:GridHyperLinkColumn DataNavigateUrlFields="security_group" DataNavigateUrlFormatString="groupinfo.aspx?group={0}"
                        DataTextField="security_group" FilterControlAltText="Filter column column" HeaderText="Security Group"
                        UniqueName="column">
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridHyperLinkColumn>
                    <telerik:GridBoundColumn DataField="main_folder_path" FilterControlAltText="Filter main_folder_path column"
                        HeaderText="main_folder_path" SortExpression="main_folder_path" UniqueName="main_folder_path"
                        Visible="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="group_manager" FilterControlAltText="Filter group_manager column"
                        HeaderText="group_manager" SortExpression="group_manager" UniqueName="group_manager"
                        Visible="False">
                    </telerik:GridBoundColumn>
                </Columns>
                <GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <SelectFields>
                            <telerik:GridGroupByField FieldAlias="&nbsp;" FieldName="main_folder_path" HeaderValueSeparator="" />
                        </SelectFields>
                        <GroupByFields>
                            <telerik:GridGroupByField FieldAlias="Entry" FieldName="main_folder_path" />
                        </GroupByFields>
                    </telerik:GridGroupByExpression>
                </GroupByExpressions>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
        </telerik:RadGrid>
    <asp:SqlDataSource ID="dbSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT security_group, main_folder_path, sub_folder_path, group_manager FROM FOLDERS">
    </asp:SqlDataSource>
4

1 回答 1

1

这是我能做的最好的:

   <asp:GridView ID="grid1" runat="server" CellSpacing="0" DataSourceID="dbSqlDataSource"
        GridLines="None"  Width="900px" Height="550px" AutoGenerateColumns="false">
        <Columns>
        <asp:BoundField DataField="sub_folder_path" ShowHeader="true"  HeaderText="sub_folder_path" SortExpression="sub_folder_path" />
        <asp:HyperLinkField DataNavigateUrlFields="security_group" DataNavigateUrlFormatString="groupinfo.aspx?group={0}"
                    DataTextField="security_group" HeaderText="Security Group" />
           <asp:BoundField DataField="main_folder_path" 
                    HeaderText="main_folder_path" SortExpression="main_folder_path" 
                    Visible="False" />
                <asp:BoundField DataField="group_manager" 
                    HeaderText="group_manager" SortExpression="group_manager" 
                    Visible="False" />

        </Columns>

        </asp:GridView>

至于分组,请参考这些链接:

http://www.codeproject.com/Articles/113216/Group-GridView-Data
http://forums.asp.net/t/1863618.aspx/1?Grouping+of+Gridview+Columns+as+per+requirement

对于过滤,你必须自己做可以过滤列的函数和代码

于 2013-06-10T13:48:23.777 回答