473,505 Members | 15,381 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

binding a repeater

Hi,

I have a little problem

I am using a stored procedure to retrieve my date.
What I want to achieve is to be able to "skip" some row from the resultset i
retrieve back from the stored procedure. To be clear, when I Bind my
repeater I want to be able to skip some records in my repeater and not
display anything at all for that record. I do some calculation on the data i
retrieve to decide if i will bind that row or not.

In my code, in the itemDataBound even handler, I do not execute anything in
the case My calculation decide that that specific record should not be
binded. But my problem is that the row of the repeater is still displayed
eventho there is no data inside (as for that row, i do not assign any value
to the controls of that row)

I hope I am clear...

the code look like

in the page_load

reader = cmd.ExecuteReader();
RepeaterPriceChange.DataSource = reader;
RepeaterPriceChange.DataBind();
reader.Close();

in the ItemDataBound event handler of the Repeater

if (condition == true)
{
// get values for this record and assign them to the controld in the
columns of the current row of the repeater
}
else
{
// skip this record (does not work property, the repeater still display
a row with empty values in the controls of that row
}
Then is it possible to skip and all row of repeater? If yes how to do?

Best regards,

francois
Nov 18 '05 #1
3 4364
francois wrote:
Hi,

I have a little problem

I am using a stored procedure to retrieve my date.
What I want to achieve is to be able to "skip" some row from the resultset i
retrieve back from the stored procedure. To be clear, when I Bind my
repeater I want to be able to skip some records in my repeater and not
display anything at all for that record. I do some calculation on the data i
retrieve to decide if i will bind that row or not.

In my code, in the itemDataBound even handler, I do not execute anything in
the case My calculation decide that that specific record should not be
binded. But my problem is that the row of the repeater is still displayed
eventho there is no data inside (as for that row, i do not assign any value
to the controls of that row)

I hope I am clear...

the code look like

in the page_load

reader = cmd.ExecuteReader();
RepeaterPriceChange.DataSource = reader;
RepeaterPriceChange.DataBind();
reader.Close();

in the ItemDataBound event handler of the Repeater

if (condition == true)
{
// get values for this record and assign them to the controld in the
columns of the current row of the repeater
}
else
{
// skip this record (does not work property, the repeater still display
a row with empty values in the controls of that row
}
Then is it possible to skip and all row of repeater? If yes how to do?

Best regards,

francois

Francois,
Try using a templated control for this purpose. Its probably much
easier. Alternatively use the stored proc to only retreive the rows you
want to display
Hope that helps

--
Regards,
Dilip Krishnan
dilip removethis @ msn.com
Nov 18 '05 #2
Why don't take care of this inside the store procedure, should even improve its performance? Doesn't look like to me that needs to be dynamic or correct me if I am wrong

Rez
----- francois wrote: ----

Hi

I have a little proble

I am using a stored procedure to retrieve my date
What I want to achieve is to be able to "skip" some row from the resultset
retrieve back from the stored procedure. To be clear, when I Bind m
repeater I want to be able to skip some records in my repeater and no
display anything at all for that record. I do some calculation on the data
retrieve to decide if i will bind that row or not

In my code, in the itemDataBound even handler, I do not execute anything i
the case My calculation decide that that specific record should not b
binded. But my problem is that the row of the repeater is still displaye
eventho there is no data inside (as for that row, i do not assign any valu
to the controls of that row

I hope I am clear..

the code look lik

in the page_loa

reader = cmd.ExecuteReader()
RepeaterPriceChange.DataSource = reader
RepeaterPriceChange.DataBind()
reader.Close()

in the ItemDataBound event handler of the Repeate

if (condition == true

// get values for this record and assign them to the controld in th
columns of the current row of the repeate

els

// skip this record (does not work property, the repeater still displa
a row with empty values in the controls of that ro

Then is it possible to skip and all row of repeater? If yes how to do

Best regards

francoi

Nov 18 '05 #3
Actually the conditions are too complex to put in a stored procedure, then I
was wondering if it is not possible to just skip a rows in the repeater. Or
maybe I am not good enough at stored procedure :p

Anyway I will continue to look on the stored procedure side but It would be
neat to be able to have some way to "filter" out some records while you do
databinding. Maybe then I should use a DataSet instead of a reader, do some
logic on it and remove the rows 'manually' ... ugly and my point is to know
if it is possible to skip a row in the repeater but it seems like it is not.
Also I am quite new in asp.net, then what is a templated control? Excuse my
ignorance

Best regards and thank you for your answer :) It conforts me to go for the
sp for now

Francois
"Dilip Krishnan" <di******************@msn.com> wrote in message
news:uc**************@TK2MSFTNGP09.phx.gbl...
francois wrote:
Hi,

I have a little problem

I am using a stored procedure to retrieve my date.
What I want to achieve is to be able to "skip" some row from the resultset i retrieve back from the stored procedure. To be clear, when I Bind my
repeater I want to be able to skip some records in my repeater and not
display anything at all for that record. I do some calculation on the data i retrieve to decide if i will bind that row or not.

In my code, in the itemDataBound even handler, I do not execute anything in the case My calculation decide that that specific record should not be
binded. But my problem is that the row of the repeater is still displayed eventho there is no data inside (as for that row, i do not assign any value to the controls of that row)

I hope I am clear...

the code look like

in the page_load

reader = cmd.ExecuteReader();
RepeaterPriceChange.DataSource = reader;
RepeaterPriceChange.DataBind();
reader.Close();

in the ItemDataBound event handler of the Repeater

if (condition == true)
{
// get values for this record and assign them to the controld in the
columns of the current row of the repeater
}
else
{
// skip this record (does not work property, the repeater still display a row with empty values in the controls of that row
}
Then is it possible to skip and all row of repeater? If yes how to do?

Best regards,

francois

Francois,
Try using a templated control for this purpose. Its probably much
easier. Alternatively use the stored proc to only retreive the rows you
want to display
Hope that helps

--
Regards,
Dilip Krishnan
dilip removethis @ msn.com

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3269
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object...
2
1643
by: Donald Williamson | last post by:
I have a DataReader that I am binding to a Repeater control. In the DataReader, I have two fields: 'Name1' and 'Name2' 'Name1' will always have a person's name. Name2 periodically has a person's...
2
2306
by: Gastin | last post by:
I am consuming a web serivce from Amazon.Com. I have the following class which was autogenerated by VS.NET when I created a Web Reference to...
4
1964
by: Alan Silver | last post by:
Hello, I'm trying to use an ArrayList to do data binding, but am getting an error I don't understand. I posted this in another thread, but that was all confused with various other problems,...
2
1634
by: ChrisA | last post by:
I have an array of objects I'm binding to a Repeater. Unfortunately, I need to bind to the value returned from a method, while Eval() only seems to work on Properties. Is there a way to do this?...
9
4674
by: Jaybuffet | last post by:
my aspx has something like this <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>' showItem="true"/> </ItemTemplate>...
3
1539
by: Alex Maghen | last post by:
I'm having trouble with my repeater: I'm binding my Repeater control to an OleDbDataReader object. My ASPX looks like this: <asp:Repeater ID="Rptr" runat="server"> <ItemTemplate> <asp:Label...
4
4885
by: Brad Baker | last post by:
I'm going a little crazy :) I'm trying to bind a repeater control to a dataset on page load using the following code: if (Request.QueryString != null) { string customerid = Request.QueryString;...
5
14156
by: DotNetNewbie | last post by:
Hi, It is not possible to bind a Generic.List collection to a repeater I guess huh? I am getting this error: An invalid data source is being used for rpCategories. A valid data source must...
12
2144
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I'm doing a web app in VB/Dot Net 2.0. I'm probably a bit rusty and I have no experience using the repeater control. I have a user control I've created with multiple properties. I've created a...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.