Sorting and paging

D

DC Gringo

I have set up numerous datagrid controls and had a recurring problem with
the sorting and paging features. They simply don't work and generate and
"error on page" every time.

Help?
 
S

Scott Mitchell [MVP]

I have set up numerous datagrid controls and had a recurring problem
with
the sorting and paging features. They simply don't work and generate and
"error on page" every time.

What's the error message you get? Are you using Cassini as the Web
server, or IIS? (I have noticed that with Cassini, at times, DataGrids
with *large* ViewStates sometimes seem to muck up Cassini, resulting in a
"No response from server" error in the browser.

--

<shameless plug>
For more information on the DataGrid, DataList, and Repeater controls,
consider picking up a copy of my latest book:

ASP.NET Data Web Controls
http://www.amazon.com/exec/obidos/ASIN/0672325012/4guysfromrollaco
</shameless plug>

Happy Programming!

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
D

DC Gringo

I'm using IIS. Basically the hyperlinks don't do anything...clicking on it
yields "error on page" in the lower status bar whether it's the sorting
header or the paging 1-10 links.

_____
DC G
 
S

Scott Mitchell [MVP]

I'm using IIS. Basically the hyperlinks don't do anything...clicking on
it
yields "error on page" in the lower status bar whether it's the sorting
header or the paging 1-10 links.

The error is a client-side JavaScript error, it sounds like. What if you
click on that little error icon, what is the message it shows? What line
number? Do a View/Source to see what line the problem is on.

Just out of curiosity, are you using a User Control with a <form
runat="server">...</form> in it?

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
D

DC Gringo

Scott...you NAILED it!

Two sets of form tags...what a rouse!!

Ok, so now I'm getting somewhere...it is now posting back...what's left is
handling the event of clicking on hyperlink to do the actual sort. The
example I'm working with gives me the code below, but I'm using a DataSet of
two tables from a stored procedure rather than a dataview. How would I
modify this to suit?

(Name of SqlDataAdapter DataSet is "DsAdvanced1". Tables are "table1" and
"table2". I need to bind and sort "table1".)

--START EXAMPLE CODE--

Private Sub DataGrid1_SortCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) _
Handles DataGrid1.SortCommand
DataView.Sort = e.SortExpression
DataGrid1.DataBind()
End Sub

--END EXAMPLE CODE--
 
S

Scott Mitchell [MVP]

I don't think I'll be able to help you further - it sounds like you are
using the GUI in VS.NET to bind data to a DataGrid. Personally, I have
always done this in code myself, so I'm afraid I'm not familiar with the
code generated by the GUI tools and how to utilize them.

Good luck.

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
D

DC Gringo

Scott, yes you're right, I've not been terribly happy with using the GUI,
I'm going to switch on this one pretty soon.

_____
DC G
 
S

Scott Mitchell [MVP]

Scott, yes you're right, I've not been terribly happy with using the
GUI,
I'm going to switch on this one pretty soon.

I teach a class on ASP.NET and it surprises me how many students use the
GUI tools. In talking with high-end ASP.NET developers, I have found that
virtually none of them employ these GUI tools...

I applaud you for your decision. For more information on the DataGrid
using the non-GUI techniques, I would (humbly) recommend that you check
out this 15-part article series I wrote:

An Extensive Examination of the DataGrid Web Control
http://aspnet.4guysfromrolla.com/articles/040502-1.aspx

Another great resource of common DataGrid questions (and answers) is
available at:
http://datawebcontrols.com

Happy Programming!

--

<shameless plug>
For more information on the DataGrid, DataList, and Repeater controls,
consider picking up a copy of my latest book:

ASP.NET Data Web Controls
http://www.amazon.com/exec/obidos/ASIN/0672325012/4guysfromrollaco
</shameless plug>

Happy Programming!

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top