Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Sorting a dataview

Reply
Thread Tools

Sorting a dataview

 
 
=?Utf-8?B?U3VuZWV0?=
Guest
Posts: n/a
 
      08-10-2004
Hello,

I am trying to sort the values of a dataset based on the column the user
selects on the web page, how the code below does not sort. I have hard coded
a column for now, but any suggestions would be appreciated.

Dim comInvView As DataView 'Community Inventory View

'Put user code to initialize the page here
Dim objCommunityInventory As DataSet
Dim aSqlParameter(2) As SqlClient.SqlParameter
aSqlParameter(0) = GetSqlParameter("@DivisionID",
Request.QueryString("DivisionID"), SqlDbType.Int)
aSqlParameter(1) = GetSqlParameter("@CommunityID",
Request.QueryString("CommunityID"), SqlDbType.Int)
aSqlParameter(2) = GetSqlParameter("@PhaseID",
IIf(Request.QueryString("PhaseID").ToString = "0", DBNull.Value,
Request.QueryString("PhaseID")), SqlDbType.Int)
objCommunityInventory = New DataSet()
lblDate.Text = Now.ToString

FillDataSet("rptCommunityInventory", aSqlParameter,
CType(objCommunityInventory, Object), "CommunityInventory")

objCommunityInventory.Tables(0).Columns.Remove("Ti tle")
objCommunityInventory.AcceptChanges()


comInvView =
objCommunityInventory.Tables("CommunityInventory") .DefaultView()
comInvView.Sort = "Status DESC"
dgCommunityInventory.DataSource = comInvView
dgCommunityInventory.DataBind()


Thanks
Suneet
 
Reply With Quote
 
 
 
 
Duron
Guest
Posts: n/a
 
      08-10-2004
How if

Dim dt As DataTable
dt = objCommunityInventory.Tables("CommunityInventory")
dt.DefaultView.Sort = "Status DESC"
dgCommunityInventory.DataSource = dt.DefaultView
dgCommunityInventory.DataBind()

-Duron

"Suneet" <(E-Mail Removed)> glsD
:(E-Mail Removed)...
> Hello,
>
> I am trying to sort the values of a dataset based on the column the user
> selects on the web page, how the code below does not sort. I have hard

coded
> a column for now, but any suggestions would be appreciated.
>
> Dim comInvView As DataView 'Community Inventory View
>
> 'Put user code to initialize the page here
> Dim objCommunityInventory As DataSet
> Dim aSqlParameter(2) As SqlClient.SqlParameter
> aSqlParameter(0) = GetSqlParameter("@DivisionID",
> Request.QueryString("DivisionID"), SqlDbType.Int)
> aSqlParameter(1) = GetSqlParameter("@CommunityID",
> Request.QueryString("CommunityID"), SqlDbType.Int)
> aSqlParameter(2) = GetSqlParameter("@PhaseID",
> IIf(Request.QueryString("PhaseID").ToString = "0", DBNull.Value,
> Request.QueryString("PhaseID")), SqlDbType.Int)
> objCommunityInventory = New DataSet()
> lblDate.Text = Now.ToString
>
> FillDataSet("rptCommunityInventory", aSqlParameter,
> CType(objCommunityInventory, Object), "CommunityInventory")
>
> objCommunityInventory.Tables(0).Columns.Remove("Ti tle")
> objCommunityInventory.AcceptChanges()
>
>
> comInvView =
> objCommunityInventory.Tables("CommunityInventory") .DefaultView()
> comInvView.Sort = "Status DESC"
> dgCommunityInventory.DataSource = comInvView
> dgCommunityInventory.DataBind()
>
>
> Thanks
> Suneet



 
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
Sorted DataView, but unsorted datalist when bound to the dataview CodeMonkey ASP .Net 1 02-04-2011 10:55 AM
DataView Sorting with Paging Question Patrick Olurotimi Ige ASP .Net 2 12-09-2004 06:29 AM
DataView data accessor aware of sorting used =?Utf-8?B?TWljaGHFgiBKYW51c3pjenlr?= ASP .Net 0 11-22-2004 04:53 PM
dataview sorting in manual order? Jason ASP .Net 7 09-02-2004 03:38 PM
Re: alpha numeric sorting for dataview John Saunders ASP .Net 0 07-20-2004 09:08 PM



Advertisments