Repeater2 - Filters the SQL Select Statement to only show records from Today - This does not
You should do to deal with Rep2 to filter records with itself just like what you do to Rep1,and plz make sure that you cannot bind both of the two reps to the same datasource。
Protected Sub AccessDataSource1_Filtering(sender As Object, e As System.Web.UI.WebControls.SqlDataSourceFilteringEventArgs) Handles AccessDataSource1.Filtering
e.ParameterValues(0) = varStartDate1
e.ParameterValues(1) = varStartDate2
End Sub
Private varStartDate1 As String
Private varStartDate2 As String
Protected Sub Repeater1_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound
varStartDate1 = "1/1/2012 11:59 PM"
varStartDate2 = "1/2/2012 11:59 PM"
End Sub
Protected Sub Repeater2_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater2.ItemDataBound
varStartDate1 = "2/1/2012 11:59 PM"
varStartDate2 = "2/2/2012 11:59 PM"
End Sub
So obviously this isn't giving me the desired results, I'm not sure how to re-apply the filter
Protected Sub AccessDataSource1_Filtering(sender As Object,
e As System.Web.UI.WebControls.SqlDataSourceFilteringEventArgs)
Handles AccessDataSource1.Filtering
e.ParameterValues(0) = varStartDate1
e.ParameterValues(1) = varStartDate2
End Sub
Private varStartDate1 As String
Private varStartDate2 As String
Protected Sub Repeater1_ItemDataBound(sender As Object,
e As System.Web.UI.WebControls.RepeaterItemEventArgs)
Handles Repeater1.ItemDataBound
varStartDate1 = "1/1/2012 11:59 PM"
varStartDate2 = "1/2/2012 11:59 PM"
End Sub
Protected Sub Repeater2_ItemDataBound(sender As Object,
e As System.Web.UI.WebControls.RepeaterItemEventArgs)
Handles Repeater2.ItemDataBound
varStartDate1 = "2/1/2012 11:59 PM"
varStartDate2 = "2/2/2012 11:59 PM"
End Sub
Yes, I thought that was the point of filtering, to avoid multiple trips to the database. The way I'm figuring it, I have one data source grab all the records I'm going to need, then I filter them for each repeater (I'm going to need 10 repeaters).
If I use a DataSource for all the repeaters, why would I need to use filtering?
Yes, I thought that was the point of filtering, to avoid multiple trips to the database. The way I'm figuring it, I have one data source grab all the records I'm going to need, then I filter them for each repeater (I'm going to need 10 repeaters).
Yes,agree with on the point。We don't suggest you using the same DataSource for different kinds of filtering。
JStellato
If I use a DataSource for all the repeaters, why would I need to use filtering?
Depends on you,I don't know why you need to use filtering……Maybe sharing one DataSource cause the problem of side-effects……
JStellato
Member
147 Points
228 Posts
Filtering a Datasource with Two Data Repeaters
Feb 05, 2012 10:21 PM|LINK
Hello, I have an access datasource which I'm filtering records from, my question is how do I re-filter the returned records
For Example, I have
AccessDataSource1
Repeater1 - Filters the SQL Select Statement to only show records from Yesterday - This works
Repeater2 - Filters the SQL Select Statement to only show records from Today - This does not
The repeater2 is where I'm having an issue, while I can initially filter the recordset, I have no idea how to refilter it for the second repeater.
accessdatasource filterexpression sql filter
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Filtering a Datasource with Two Data Repeaters
Feb 07, 2012 01:15 AM|LINK
You should do to deal with Rep2 to filter records with itself just like what you do to Rep1,and plz make sure that you cannot bind both of the two reps to the same datasource。
If possible,show us your full codes。
Reguards!
accessdatasource filterexpression sql filter
JStellato
Member
147 Points
228 Posts
Re: Filtering a Datasource with Two Data Repeaters
Feb 07, 2012 02:02 AM|LINK
Well I guess I don't quite understand, here's what I have in shortened form:
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="Database.mdb" SelectCommand="SELECT * FROM tablename"FilterExpression="Time1 >= '{0}' AND Time1 <= '{1}'"> <FilterParameters> <asp:Parameter Name="Time1" Type="String"/> <asp:Parameter Name="Time2" Type="String"/> </FilterParameters> </asp:AccessDataSource>aasdf
Protected Sub AccessDataSource1_Filtering(sender As Object, e As System.Web.UI.WebControls.SqlDataSourceFilteringEventArgs) Handles AccessDataSource1.Filtering e.ParameterValues(0) = varStartDate1 e.ParameterValues(1) = varStartDate2 End Sub Private varStartDate1 As String Private varStartDate2 As String Protected Sub Repeater1_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound varStartDate1 = "1/1/2012 11:59 PM" varStartDate2 = "1/2/2012 11:59 PM" End Sub Protected Sub Repeater2_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater2.ItemDataBound varStartDate1 = "2/1/2012 11:59 PM" varStartDate2 = "2/2/2012 11:59 PM" End SubSo obviously this isn't giving me the desired results, I'm not sure how to re-apply the filter
accessdatasource filterexpression sql filter
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Filtering a Datasource with Two Data Repeaters
Feb 07, 2012 02:06 AM|LINK
Sorry your aspx codes are in a line……,please repaste them again。
And how many datasources are you now using?
accessdatasource filterexpression sql filter
JStellato
Member
147 Points
228 Posts
Re: Filtering a Datasource with Two Data Repeaters
Feb 07, 2012 02:43 AM|LINK
Sorry not sure what happened there:
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="Database.mdb" SelectCommand="SELECT * FROM tablename"FilterExpression="Time1 >= '{0}' AND Time1 <= '{1}'"> <FilterParameters> <asp:Parameter Name="Time1" Type="String"/> <asp:Parameter Name="Time2" Type="String"/> </FilterParameters> </asp:AccessDataSource>and I'm still just using 1 data source
Thanks!
accessdatasource filterexpression sql filter
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Filtering a Datasource with Two Data Repeaters
Feb 07, 2012 05:33 AM|LINK
Are you using the same DataSource for two Repeaters?
JStellato
Member
147 Points
228 Posts
Re: Filtering a Datasource with Two Data Repeaters
Feb 07, 2012 01:12 PM|LINK
Yes, I thought that was the point of filtering, to avoid multiple trips to the database. The way I'm figuring it, I have one data source grab all the records I'm going to need, then I filter them for each repeater (I'm going to need 10 repeaters).
If I use a DataSource for all the repeaters, why would I need to use filtering?
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Filtering a Datasource with Two Data Repeaters
Feb 08, 2012 12:30 AM|LINK
Yes,agree with on the point。We don't suggest you using the same DataSource for different kinds of filtering。
Depends on you,I don't know why you need to use filtering……Maybe sharing one DataSource cause the problem of side-effects……