Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 26th, 2006, 11:35 AM
Authorized User
 
Join Date: Jan 2006
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to sort a column in data grid:

How to sort a column in data grid:

I want to sort on the column "LoanNumber"

In my ASP code shown below, I added AllowSorting property to True, in the
DataGrid.Which gives me the hyperlink in the header.
In order to have this happen I need to do two things: create a
sort event handler and specify the event handler for the
DataGrid's sort event.

I created the sub SortEventHandler as below but I am lost as to
what is next to do?



Sub SortEventHandler(sender as Object, e as DataGridSortCommandEventArgs)
   ...
End Sub


<asp:datagrid id="DG1" runat="server" BackColor="Gainsboro" AutoGenerateColumns="false"
OnItemCommand="DGColumnBtn"
        Width="512px" AllowSorting="True">
        <EditItemStyle BackColor="Red"></EditItemStyle>
        <AlternatingItemStyle BackColor="#C0FFFF"></AlternatingItemStyle>
        <HeaderStyle BackColor="Silver"></HeaderStyle>
        <AlternatingItemStyle BackColor="White" />
    <Columns>
    <asp:ButtonColumn Text="Details" HeaderText="Credit Life" ButtonType="PushButton" />
    <asp:BoundColumn DataField="clid" Visible="False" />
    <asp:BoundColumn DataField="CLMaturityDate" DataFormatString="{0:MM-dd-yyyy}" HeaderText="MAT Date" />
    <asp:BoundColumn DataField="LoanNumber" HeaderText="LoanNumber" SortExpression="LoanNumber" />
    <asp:BoundColumn DataField="Loanamount" HeaderText="Amount" />
    </Columns>
    </asp:datagrid></form>




 Private Sub DG1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DG1.SelectedIndexChanged

    End Sub



  #2 (permalink)  
Old January 26th, 2006, 02:03 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Check this article:
http://samples.gotdotnet.com/quickst..._datagrid.aspx

Jim

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
export data grid hyperlink column to excel phyzie VS.NET 2002/2003 0 April 16th, 2007 01:45 AM
How to sort data in a data grid? zaheerabbas.sk ASP.NET 1.0 and 1.1 Basics 3 April 10th, 2007 02:37 PM
How do you make a Data Grid Hyperlink Column pass KarmenC ASP.NET 1.x and 2.0 Application Design 5 January 13th, 2005 11:43 AM
Data Grid Drop Down List Column bmains ASP.NET 1.0 and 1.1 Professional 4 September 21st, 2004 08:39 AM



All times are GMT -4. The time now is 12:29 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.