Another ASP.NET question: LinkButton inside a Repeater... help!

notfred

Lifer
Feb 12, 2001
38,241
4
0
Ok, so I have a specific question this time.

You can see my code from my .aspx file below. That code LOOKS like it runs fine. That is, it creates a ButtonLink with the appropriate text from Container.Data.

However, if I attempt to access the Text property of my LinkButton, the value is always null. I get a sueable value if I leave out the <%# code %> block and use plain text, but if I have that block in my code, I always get a null value, even if I put a plain string in it, like this: <%# "bob" %>.

That will draw a ButtonLink with "bob" as its text, but I will not be able to read that text from my program when the next page loads. I hope that makes sense.

Basically, what I'm trying to do is dynamically create the text for a ButtonLink, and then when someone clicks on that ButtonLink, I want to be able to get that text from it, but I'm getting null values instead.
 

replicator

Senior member
Oct 7, 2003
431
0
0
Assuming that you are using an array of string to bind the repeater, try this.
Might not be exactly what you want to do, but it is an example of how to pull out a text value from a control in a repeater.
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Originally posted by: replicator
Assuming that you are using an array of string to bind the repeater, try this.
Might not be exactly what you want to do, but it is an example of how to pull out a text value from a control in a repeater.

That works, thanks a lot :)