Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Repeater

Reply
Thread Tools

Repeater

 
 
Peter Kirk
Guest
Posts: n/a
 
      10-05-2005
Hi there

I have some c# code which extracts a list of data (an array of Port objects)
from a database, and I need to display this data on an asp, where the user
can see and edit the data (and press a "save" button to write changes back
to the database).

I am using a "repeater" to list the Port items on the page, where some of
the attributes of the Port objects are textboxes where the user can edit the
data.

My problem is the "save" button - for this I have an onclick handler, but
how does the list of Port objects get supplied to the onclick method so I
can write to the database?

Thanks for any help,
Peter


 
Reply With Quote
 
 
 
 
S.M. Altaf [MVP]
Guest
Posts: n/a
 
      10-05-2005
Peter,

The Save button is a single button and is not repeated, correct?

In the button's Click event, declare textbox variables that correspond to
the textboxes in each row of the repeater.

foreach(RepeaterItem rItem in rptRepeater.Items)
{
txtPort1 = (TextBox)rItem.FindControl("txtPortName");
txtPort2 = (TextBox)rItem.FindControl("txtPortPrice"); //Other
processing. }Where I've written 'other processing', you can take the
values in the textboxes, and save them back to the database. This will get
performed for each row of the repeater.
HTH
S.M. Altaf - MVP VB

--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com






"Peter Kirk" <> wrote in message
news:...
> Hi there
>
> I have some c# code which extracts a list of data (an array of Port
> objects) from a database, and I need to display this data on an asp, where
> the user can see and edit the data (and press a "save" button to write
> changes back to the database).
>
> I am using a "repeater" to list the Port items on the page, where some of
> the attributes of the Port objects are textboxes where the user can edit
> the data.
>
> My problem is the "save" button - for this I have an onclick handler, but
> how does the list of Port objects get supplied to the onclick method so I
> can write to the database?
>
> Thanks for any help,
> Peter
>
>



 
Reply With Quote
 
 
 
 
Peter Kirk
Guest
Posts: n/a
 
      10-05-2005

"S.M. Altaf [MVP]" <> skrev i en meddelelse
news:%...
> Peter,
>
> The Save button is a single button and is not repeated, correct?
>
> In the button's Click event, declare textbox variables that correspond to
> the textboxes in each row of the repeater.
>
> foreach(RepeaterItem rItem in rptRepeater.Items)
> {
> txtPort1 = (TextBox)rItem.FindControl("txtPortName");
> txtPort2 = (TextBox)rItem.FindControl("txtPortPrice"); //Other
> processing. }Where I've written 'other processing', you can take the
> values in the textboxes, and save them back to the database. This will
> get performed for each row of the repeater.
> HTH
> S.M. Altaf - MVP VB


Great, thanks.
Peter


 
Reply With Quote
 
Peter Kirk
Guest
Posts: n/a
 
      10-06-2005

"S.M. Altaf [MVP]" <> skrev i en meddelelse
news:%...
> Peter,
>
> The Save button is a single button and is not repeated, correct?


The save button is in the "Footer" section of the repeater.
Do you know how I can stop the footer from being processed if the repeater
list is empty? For example, if there is no list then I don't want the save
button to be dsiplayed.

Thanks,
Peter


 
Reply With Quote
 
Peter Kirk
Guest
Posts: n/a
 
      10-06-2005

"Peter Kirk" <> skrev i en meddelelse
news:...
>
> "S.M. Altaf [MVP]" <> skrev i en meddelelse
> news:%...
>> Peter,
>>
>> The Save button is a single button and is not repeated, correct?

>
> The save button is in the "Footer" section of the repeater.
> Do you know how I can stop the footer from being processed if the repeater
> list is empty? For example, if there is no list then I don't want the save
> button to be dsiplayed.


OK, I found out I can check <% if (myList.Items.Count > 0) ....


 
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
repeater inside a repeater problem. uncensored ASP .Net 0 10-25-2006 06:10 PM
Repeater inside a Repeater Microsoft ASP .Net Web Controls 0 08-21-2006 09:13 AM
Repeater inside a repeater....how? voidfill3d@yahoo.com ASP .Net 1 08-10-2005 01:58 PM
Repeater Using Javascript Referencing a Column in the Repeater rwoo_98@yahoo.com ASP .Net 0 02-26-2005 05:02 PM
Repeater control with nested repeater chris.reed@digus.com ASP .Net 0 02-11-2005 05:10 PM



Advertisments