Under Easy Control - can't sort with Grid controls

Topics: User Forum
Nov 26, 2006 at 10:21 PM
Just began trying to insert sorting capability using the Grid controls that I inserted in the "Easy Control" section.

Doesn't seem to work for some reason.

Any thoughts?


Nov 27, 2006 at 7:38 AM
Yes, strange. It doesn't work if selected in the 'GridView Tasks'. But it works when I set it explicitly with a line of code:

GridView1.AllowSorting = true;
Dec 6, 2006 at 11:21 PM
Please tell me where you would insert that code (GridView1.AllowSorting = true) in the following source.

I've been trying to avoid changing source so that future modifications to the project can be made as easily as possible.
So if you change the system so that it is not necessary to add source for the grid sort capability that would be great.

I am a newbie and (obivously) not familiar with the code. Thanks for any help.


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="HelloWorld.ascx.cs" Inherits="EasyControls_HelloWorld" %>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM ShoeReviewTable" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"></asp:SqlDataSource>
Dec 7, 2006 at 5:10 AM
This discussion has been copied to Work Item 6316. You may wish to continue further discussion there.
Dec 7, 2006 at 7:00 AM
Here is the example with the additional line in the Page_Load event handler:

<%@ Control Language="C#" ClassName="MyTest2" %>

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
GridView1.AllowSorting = true;

<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="VEN_Id" DataSourceID="AccessDataSource1" EmptyDataText="There are no data records to display.">
<asp:BoundField DataField="VENId" HeaderText="VENId" SortExpression="VEN_Id" />
<asp:BoundField DataField="VENTitle" HeaderText="VENTitle" SortExpression="VEN_Title" />
<asp:BoundField DataField="VENDescription" HeaderText="VENDescription" SortExpression="VEN_Description" />
Dec 7, 2006 at 12:01 PM
Wow! You guys are good. Thanks for the fast response.