I have a datagrid with sorting. I set enable sorting to true, but that makes every column sortable. Is there a simple way to make it so that only one column header can be clicked for sorting? I feel like there should be a simple and quick fix for this, but who knows.
some code:
<asp:GridView ID="ProductsGrid" runat="server"
AutoGenerateColumns="False" Heig开发者_运维问答ht="323px"
style="margin-top: 23px; margin-left: 0px;" BackColor="White" CellPadding="0"
Width="1210px" OnPageIndexChanging="gridView_PageIndexChanging"
onrowdatabound="ProductsGridView_RowDataBound" AllowPaging="True"
PageSize="25" AllowSorting="True" OnSorting="ProductsGrid_SortCommand">
I then have several columns. Is there something I can set in the code for the column to disable all others or only make one sortable?
http://msdn.microsoft.com/en-us/library/aa479347.aspx
You can specify if a column should be sortable or not by its SortExpression property.
Hope this helps.
精彩评论