 |
|
|
 |
|
 |
How can I use it with SqlDataReader?
|
|
|
|
 |
|
 |
Like this:
yourRepObj.DataSource = yourSQLdata;
yourRepObj.DataBind();
Download the the new sourcecode it is updated after you wrote your question
But this is a very old article, so if you can use the ListView then use it instead
|
|
|
|
 |
|
 |
I implemented sorting with this - but found the datarepeater was displaying data from one click ago - even though the datasource is correct and the databind is done just after. - I belive it may have something to do with the persistent datasource - but when I turn that off I get a null returned from GetData().
Has anybody else come across this? How do I fix the issue?
-cheers in advance.
|
|
|
|
 |
|
|
 |
|
 |
Excellent work. Exactly what i was looking for. Thank you so much. Amazing this isnt a part of .NET already. It should DEFINITELY be on CodePlex.
|
|
|
|
 |
|
 |
Hi,
First off, thanks for the great example. It's almost exactly what I needed.
I'm trying to implement the version of the control that you have at http://www.publech.com/DataPagerRepeater.zip[^].
My understanding is that when the FetchingData event is raised, I should re-bind the repeater with the next or previous page of data and set the total records. The problem I'm having is that that the FetchingData event is raised before the new StartRowIndex value is set by the DataPager so essentially, all I can do is rebind the previous page of data.
What I ended up doing is checking for IsPostBack in the SetPageProperties method (because it seems that the DataPager eventually calls it) and doing the same checks you did in OnLoad then calling FetchingData there. Paging now works correctly with the intended page of data but only because FetchData is now called twice, thus doubling my calls to the database.
Is this working for anyone? Is there a way call FetchingData only after the new page index has been set by the DataPager?
Thanks,
Chad
|
|
|
|
 |
|
 |
Well, for anyone who cares (apparently no one), I did away with the Fetching data event altogether and bound my data in two places:
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
BindData(1) ' Pass Page Number
End If
End Sub
And on the PreRender event of the DataPager control itself as this is about the only place you can be guaranteed that the proper page indexes have been set:
Private Sub DataPager1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataPager1.PreRender
If Page.IsPostBack Then ' Already bound on page load.
BindData(rep1.StartRowIndex + 1) ' Pass Page Number
End If
End Sub
The page now behaves as expected.
I've seen other articles using this same approach, even with the ListView and a DataPager and this is what ultimately works for this control as well.
Chad
|
|
|
|
 |
|
 |
I'm having a problem when using DataPagerRepeater inside an Update Panel.
What happens is that on a button I rebind the repeater to a new data source and calls the update panel update().
The bug is that the repeater isn't update with the new data.
I've traced the databind function and what happens is that on the GetData() function I get the old data and it is not being replaced with the DataSource property.
Can you please fix it?
Thanks.
|
|
|
|
 |
|
|
 |
|
 |
This is the same version that I'm using...
Like I said, the problem is in the GetData() method.
It doesn't update the dataObjects because it isn't null.
Thanks.
|
|
|
|
 |
|
 |
I replaced the code in the download yesterday with a new version. I have included updatepanel in the test project
|
|
|
|
 |
|
 |
Your example is working for some reason it doesn't work in my code.
In my code, in the GetData() function, when base.GetData() is called I get the old data source and not the new one I just put in.
What could be the reason for this?
Thanks.
|
|
|
|
 |
|
 |
ok, I found the reason.
You removed the "else" in the OnDataPropertyChanged.
That fixed it, Thanks again.
|
|
|
|
 |
|
 |
Sorry, but there seems to be another problem now.
When I have a LinkButton inside my updatepanel , everything works ok.
When I have a button, I get the following error:
"
Message: Sys.WebForms.PageRequestManagerServerErrorException: 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.
"
If I replace the DataPagerRepeater with a regular Repeater, then the everything works correct.
Any ideas?
Thanks.
|
|
|
|
 |
|
 |
This is not paging at all
|
|
|
|
 |
|
|
 |
|
 |
From SQL2005 and up you can do a quick pageing in db with the ROW_NUMBER()/OVER function and a #temp table
--Pageingparams
@PageIndex int,
@PageSize int
--
Select ROW_NUMBER() OVER (ORDER BY col1)AS Row, --Add this the old existing unpaged query and move ORDER BY to the OVER command
col1,
col2,
col3
into #temp --Add this to the old existing unpaged query
from table1
Where col1 = [somevalue]
--This part will be the same for all paged queries
Select *
from #temp
WHERE Row between (@PageIndex +1) and @PageIndex + @PageSize
Select count(*) as TotalRows
FROM #temp
Drop table #temp
|
|
|
|
 |
|
 |
Hi,
Thanks for your great code.
I tried to use it in my site.
I have two DataPagerRepeater on my page.
One of them works great but the other one doesn't work.
I get NullReferenceException in DataBind() because base.GetData() returns null.
Any idea why?
Thanks.
modified on Sunday, March 21, 2010 4:18 PM
|
|
|
|
 |
|
 |
I have the same problem. anyone know how to solve this?
I get this problem when i try to Connect the DataPager to my DataPagerRepeater.
How do i solve this?
if i don´t have this in my code the DataPagerRepeater work.
<asp:DataPager ID="DataPager" PagedControlID="rep1" runat="server" PageSize="2">
<asp:NumericPagerField />
modified on Tuesday, April 6, 2010 8:10 AM
|
|
|
|
 |
|
 |
Couldn't find a solution yet, let me know if you find anything....
|
|
|
|
 |
|
|
 |
|
 |
Cant download that file. can you please repost that one?
|
|
|
|
 |
|
 |
The link should work now...
|
|
|
|
 |
|
 |
Seems like you fixed it in the new version.
Thanks!
|
|
|
|
 |