Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > sorting datagrid

Thread Tools

sorting datagrid

Posts: n/a

I have a datagrid that has its columns added dynamicly at run time. When I
click on one of the new columns, the sort event handler is not being fired.

My troubleshooting steps so far:
- I created the colums at design time, and the event handler caught the
- I used the same datagrid with the design time columns created, and ran my
code. My code clears the columns, then adds new ones. Interesting result:
if the column was created in design time, cleared, then added back at run
time, the event handler caught the event. the event handler did not catch
the event fire on new columns.

Following is a code snippet:

Dim cFirstName As New StatsHyperLinkColumn("F Name", "firstName
ASC", "firstName", "player_id", "player.aspx?id={0}")
Dim cLastName As New StatsHyperLinkColumn("L Name", "lastName ASC",
"lastName", "player_id", "player.aspx?id={0}")
With dgStats.Columns
End With

and the supporting class

Public Class StatsHyperLinkColumn
Inherits HyperLinkColumn
Public Sub New()
End Sub

Public Sub New(ByVal strHeaderText As String, ByVal strSortExpression As
String, _
ByVal strDataTextField As String, ByVal
strDataNavigateUrlField As String, _
ByVal strNavigateUrlFormatString As String)
With Me
.ItemStyle.Wrap = False
.Visible = True
.HeaderText = strHeaderText
.HeaderStyle.Wrap = False
.SortExpression = strSortExpression
.DataTextField = strDataTextField
.DataNavigateUrlField = strDataNavigateUrlField
.DataNavigateUrlFormatString = strNavigateUrlFormatString
End With
End Sub

End Class

Thanks for any help or insight.


Reply With Quote

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting list vs sorting vector C++ 2 07-06-2010 09:40 AM
fired event Sorting which wasn't handled - sorting and SelectedIndexChanged Jason ASP .Net Web Controls 0 10-04-2006 02:19 PM
[Datagrid,web form]: How the get the correct row values after sorting datagrid by header AlainCD ASP .Net Datagrid Control 0 01-12-2006 09:07 AM
sorting by multiple criterias (sub-sorting) Tom Kirchner Perl Misc 3 10-11-2003 05:16 PM
To all Gurus: How can I edit/update a DataGrid in a DataGrid (nested DataGrid)? Possible? Andreas Klemt ASP .Net Datagrid Control 0 10-08-2003 01:19 AM