Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > binding a repeater

Reply
Thread Tools

binding a repeater

 
 
francois
Guest
Posts: n/a
 
      02-10-2004
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


 
Reply With Quote
 
 
 
 
Dilip Krishnan
Guest
Posts: n/a
 
      02-10-2004
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?cmV6YXM=?=
Guest
Posts: n/a
 
      02-10-2004
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



 
Reply With Quote
 
francois
Guest
Posts: n/a
 
      02-10-2004
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

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" <(E-Mail Removed)> wrote in message
news:uceZDM$(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView binding - how to stop initial binding Amit ASP .Net 6 10-24-2006 08:06 AM
pywin32 COM sort in Excel (late binding fails, early binding works) (+py2exe) kogrover@gmail.com Python 2 10-20-2006 04:08 PM
Complex data binding question, binding child objects of a custom collection. JcFx ASP .Net Datagrid Control 0 06-01-2005 04:01 PM
Data Binding - using inline code vs. functions vs. straight binding Jordan ASP .Net 2 02-10-2004 08:32 PM
value binding and function binding Vivek Nallur Ruby 0 09-25-2003 02:52 AM



Advertisments