G
Guest
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("Title")
objCommunityInventory.AcceptChanges()
comInvView =
objCommunityInventory.Tables("CommunityInventory").DefaultView()
comInvView.Sort = "Status DESC"
dgCommunityInventory.DataSource = comInvView
dgCommunityInventory.DataBind()
Thanks
Suneet
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("Title")
objCommunityInventory.AcceptChanges()
comInvView =
objCommunityInventory.Tables("CommunityInventory").DefaultView()
comInvView.Sort = "Status DESC"
dgCommunityInventory.DataSource = comInvView
dgCommunityInventory.DataBind()
Thanks
Suneet