Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 31st, 2010, 02:33 PM
Authorized User
 
Join Date: Sep 2009
Posts: 35
Thanks: 6
Thanked 1 Time in 1 Post
Default datapager for programatic listview

Hey Imar,

I was searching through your book to see if I could find a solution to this, but I didn't seem to find it in there hopefully you can help me.

I am setting the datasource of my list view programatically (in the code behind), and due to this the datapager I am trying to use doesn't seem to be working as it would in the book (when you assign the datasource of the listview via the menus within visual web developer). The buttons do appear but they do nothing but just refresh the page (cause a post back).

Do you have any idea on what I could do here?

Thanks

When I try to just throw a datapager onto the page and assign it to the Listview I'm defining in the code I get this error:

Code:
Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Last edited by digink; May 31st, 2010 at 02:40 PM..
 
Old May 31st, 2010, 03:27 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Have you tried wrapping the assignment of your data in a !PostBack block? E.g.

Code:
 
if (!Page.IsPostBack)
{
  // get data here
  myControl.DataSource = yourData;
  myControl.DataBind();
}
Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 31st, 2010, 04:06 PM
Authorized User
 
Join Date: Sep 2009
Posts: 35
Thanks: 6
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by Imar View Post
Have you tried wrapping the assignment of your data in a !PostBack block? E.g.

Code:
 
if (!Page.IsPostBack)
{
  // get data here
  myControl.DataSource = yourData;
  myControl.DataBind();
}
Hope this helps,

Imar
I tried that but it still causes some strange behavior, like the first time NEXT is clicked nothing happens to the data, but after that it displays the second page. And I am never able to come back to the previous page.

Do you have any idea if there is any other controls I can use? I kind of want to do something where I dont need a datapager but maybe some sort of java that just has a scroll type feature? That way I can just have all the data loaded on page_load like i'm doing now and use some sort of AJAX to have a scroller.
 
Old May 31st, 2010, 04:21 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You may want to take a look here:

http://www.4guysfromrolla.com/articles/021308-1.aspx
http://www.codedigest.com/Articles/A...ASPNet_35.aspx
http://www.google.com/#hl=en&source=...+paging+custom

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
digink (May 31st, 2010)
 
Old May 31st, 2010, 04:49 PM
Authorized User
 
Join Date: Sep 2009
Posts: 35
Thanks: 6
Thanked 1 Time in 1 Post
Default

I got it to work Imar, thanks again for the suggestions.

Incase you're curious, I had to add the same data definition for the list view to the ListView1_PagePropertiesChanged event and it is working beautifully.

Thanks again!
 
Old June 1st, 2010, 02:07 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Excellent. Thanks for the follow up...

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Datapager in Listview monika.vasvani ASP.NET 3.5 Professionals 0 March 10th, 2010 05:45 AM
Datapager in Listview monika.vasvani ASP.NET 3.5 Professionals 0 March 9th, 2010 09:31 AM
DataPager & PlaceHolder positions jsymons BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 September 25th, 2009 07:50 AM
ListView fredforfree ASP.NET 2.0 Basics 1 August 1st, 2009 03:01 PM
Programatic word merge fizzerchris Access VBA 3 September 20th, 2007 09:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.