Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Accessing TextBox/Label controls inside a Repeater control

Reply
Thread Tools

Accessing TextBox/Label controls inside a Repeater control

 
 
Ashish Bandi via .NET 247
Guest
Posts: n/a
 
      05-14-2004
Hi all,

I am looking for some help on Reapeter control.

My repeater control has a textbox and label control in the itemtemplate. How can i access the values of these controls (textbox and label) in the body of the DisplayRepeater event handler (handling RepeaterItemEventArgs) ..

<asp:repeater id="myRepeater" runat="server" OnItemDataBound="DisplayRepeater">
<itemtemplate>
<asp:TextBox ID="rptxtQuantity" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Quantity") %>'></asp:TextBox>
<asp:Label ID=rplblPrice runat=server></asp:Label>
</itemtemplate>

<alternatingitemtemplate>
// what should go here
</alternatingitemtemplate>

<footertemplate>

</footertemplate>


Also, if I place the same controls in the alternatingitemtemplate (change the background color etc.), it creates a name conflict. How to avoid that.

Thanks for your help in advance.
--------------------------------
From: Ashish.

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>gYmceSzwI0WstI8Nf5PJIg==</Id>
 
Reply With Quote
 
 
 
 
Scott Mitchell [MVP]
Guest
Posts: n/a
 
      05-14-2004
Ashish Bandi via .NET 247 wrote:
> My repeater control has a textbox and label control in the itemtemplate. How can i access the values of these controls (textbox and label) in the body of the DisplayRepeater event handler (handling RepeaterItemEventArgs) ..
>
> <asp:repeater id="myRepeater" runat="server" OnItemDataBound="DisplayRepeater">
> <itemtemplate>
> <asp:TextBox ID="rptxtQuantity" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Quantity") %>'></asp:TextBox>
> <asp:Label ID=rplblPrice runat=server></asp:Label>
> </itemtemplate>


Use FindControl(). More information available at this FAQ:
http://datawebcontrols.com/faqs/Prog...Contents.shtml

Happy Programming!

--

Scott Mitchell
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.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
Making a controls ID property inside a repeater controls ItemTemplate the value of the ItemIndex? Andy B ASP .Net 1 11-15-2008 07:17 PM
RowCommand: accessing ObjectDataSource from inside gridview inside a repeater? HockeyFan ASP .Net 1 07-04-2007 05:49 AM
Accessing Server Controls inside a Repeater? John Kotuby ASP .Net 4 02-27-2007 09:12 PM
Tough Question: Accessing controls inside inline template in a user control, in a repeater Dave ASP .Net 1 12-22-2006 12:58 PM
Accessing USER CONTROL which is inside Masterpagethrough Another USER Control inside normal page. Kiran More ASP .Net Web Controls 2 11-14-2006 12:58 PM



Advertisments