Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Can't get this grid to sort no matter what - going crazy.

Reply
Thread Tools

Can't get this grid to sort no matter what - going crazy.

 
 
Dan
Guest
Posts: n/a
 
      01-08-2004
Seems like i've tried every example in the newsgroups and in
referenced articles but I just can't get this grid to sort, am I
missing something obvious?

View State = True
Allow Sorting = True
Sort Expressions in Property Builder set to Column Names

Code for Sort Command:

Private Sub DataGrid1_SortCommand(ByVal source As Object, ByVal e
As System.Web.UI.WebControls.DataGridSortCommandEvent Args) Handles
DataGrid1.SortCommand

Dim dv As New DataView(GridSet1.Tables("driverstatus_a"))

dv.Sort = e.SortExpression

DataGrid1.DataSource = dv
DataGrid1.DataBind()


End Sub

Any help is appreciated
Dan

 
Reply With Quote
 
 
 
 
Alvin Bruney
Guest
Posts: n/a
 
      01-08-2004
that code should work, what problems are you seeing?

--
Regards,
Alvin Bruney
Got tidbits? Get it here...
http://tinyurl.com/2bz4t
"Dan" <> wrote in message
news: om...
> Seems like i've tried every example in the newsgroups and in
> referenced articles but I just can't get this grid to sort, am I
> missing something obvious?
>
> View State = True
> Allow Sorting = True
> Sort Expressions in Property Builder set to Column Names
>
> Code for Sort Command:
>
> Private Sub DataGrid1_SortCommand(ByVal source As Object, ByVal e
> As System.Web.UI.WebControls.DataGridSortCommandEvent Args) Handles
> DataGrid1.SortCommand
>
> Dim dv As New DataView(GridSet1.Tables("driverstatus_a"))
>
> dv.Sort = e.SortExpression
>
> DataGrid1.DataSource = dv
> DataGrid1.DataBind()
>
>
> End Sub
>
> Any help is appreciated
> Dan
>



 
Reply With Quote
 
 
 
 
Dan
Guest
Posts: n/a
 
      01-08-2004
"Alvin Bruney" <vapor at steaming post office> wrote in message news:<>...
> that code should work, what problems are you seeing?
>
> --
> Regards,
> Alvin Bruney
> Got tidbits? Get it here...
> http://tinyurl.com/2bz4t
> "Dan" <> wrote in message
> news: om...
> > Seems like i've tried every example in the newsgroups and in
> > referenced articles but I just can't get this grid to sort, am I
> > missing something obvious?
> >
> > View State = True
> > Allow Sorting = True
> > Sort Expressions in Property Builder set to Column Names
> >
> > Code for Sort Command:
> >
> > Private Sub DataGrid1_SortCommand(ByVal source As Object, ByVal e
> > As System.Web.UI.WebControls.DataGridSortCommandEvent Args) Handles
> > DataGrid1.SortCommand
> >
> > Dim dv As New DataView(GridSet1.Tables("driverstatus_a"))
> >
> > dv.Sort = e.SortExpression
> >
> > DataGrid1.DataSource = dv
> > DataGrid1.DataBind()
> >
> >
> > End Sub
> >
> > Any help is appreciated
> > Dan
> >


Found the problem, courtesy of DataGrid Girl:

"In your ASPX, in the <aspatagrid declaration you've
got this:

DataSource="<%# GridSet1 %>"

Any Datagrid properties set declaratively will
override the ones you set in code, so when you set the DataSource to
the filtered DataView, it's not ever taking effect. Take this
property out of the declaration, and in your Page_Load, add a line to
set the DataSource to your GridSet1."

After I eliminated this code in the aspx, it worked fine. This is a
'gotcha', because VStudio automatically put this line in the aspx file
when it built the page - and I was on a wild goose chase thinking the
problem had to be in the vb code....

Thanks to all. Thank you datagrid girl.
 
Reply With Quote
 
 
 
Reply

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
Firefighters at the site of WTC7 "Move away the building is going to blow up, get back the building is going to blow up." Midex Python 24 05-07-2007 04:23 AM
Cookies will get deleted, no matter what =?Utf-8?B?dGhlIGZyaWVuZGx5IGRpc3BsYXkgbmFtZQ==?= ASP .Net 2 04-28-2006 07:56 PM
assistI am havong trouble with my IE no matter whqat I do I continue to get a cannot Frederick Rogers Computer Support 1 09-07-2005 01:43 AM
Whattsa Matter, Dark Matter?? A.Melon DVD Video 0 05-16-2004 07:05 AM
Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. Navin ASP General 1 09-09-2003 07:16 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57