Solved

How Do You Insert Values Into Control Elements Inside an ASP.NET Repeater?

Posted on 2013-05-16
2
279 Views
Last Modified: 2013-06-02
I am using an ASP.NET repeater tag with linkbutton controls inside the repeater tag.  How do you insert values inside a linkbutton tag when it is inside the ASP.NET repeater elements?  I want to do this from the C# code behind the ASP.NET page.

Thanks,

Dan
0
Comment
Question by:danielolorenz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
Ivo Stoykov earned 500 total points
ID: 39173908
Hi,

You have several options.
If you bind some data (database?) use Repeater.ItemDataBound Event. It occurs after Repeater's each child is data-bound but before rendering.
in the method check the current item and set value i.e.
void Repeater1_ItemDataBound(Object Sender, RepeaterItemEventArgs e) {
  (LinkButton )e.Item.FindControl("LinkButton").Text = "desired value here";
}

Open in new window


Other option is to use Repeater.ItemCreate time to set the value

void R1_ItemCreated(Object Sender, RepeaterItemEventArgs e) {
// same as above
}

Open in new window


Finally you could use Control.PreRender. There you could set value directly
Look also Control.OnPreRender Method

HTH

Ivo Stoykov
0
 

Author Closing Comment

by:danielolorenz
ID: 39215316
Thanks for your help
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question