datagrid sort issue

S

sam

Hello group,
The webpage I am working with has 3 datagrids. All the 3
datagrids pretty much does the same thing expect for some minor
variations.
I have a print version link in the page and when I try to
view the "print version" after sorting based on particular columns,
the sort order reverts back to the original datagrid. I preserve the
sortorder and sortcolumn properties in viewstate and after the
postback(click on the "print version" link), sort it again to retain
the sort order. But for some reason, the sort order doesnt remain in
place. Here is the code I use:

If Me.IsPrintVersion Then
dtpart1 = dsWIP.Tables(1) ' dsWIP is a dataset containing
multiple tables.
dvWIP = New DataView(dtpart1)
dvWIP.Sort = Me.SortColumn & " " & Me.SortOrder
dgwip.datasource = dvWIP.Table
Me.dgWIP.DataBind()
'Me.dgWIP.DataSource = addHeaderLines(dtpart1, 1)
'Me.dgWIP.DataBind()
--- (Trying to use the "addHeaderLines" function which
inserts related headers for every page but cant get the simple thing
to work.. So, once the sort issue is resolved, I would let you'all
know abt the addHeaderLines function.)
Else
dgWIP.AllowSorting = True
dgWIPPart2.AllowSorting = True
dgWIPPart3.AllowSorting = True
Me.dgWIP.DataSource = dsWIP.Tables(1)
Me.dgWIP.DataBind()

thisColor = Color.Gainsboro
End If


The "sortColumn" and "sortOrder" has the desired values but for some
reason, the sort doesnt reflect on the datagrid(dgwip).

Any help would be appreciated!!


Thanks,
Sam.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top