|
-
Sep 10th, 2002, 06:29 PM
#1
Thread Starter
Hyperactive Member
Dynamically creating webforms using repeater
Hi, I have a repeater which I have bound to a DataReader to display information.
What I would like to do is inside the repeater dynamically create buttons to associate with each record retrieved from the database. Something like the following
Code:
<asp:Button ID='T<%# Container.DataItem("PageId") %>' runat=server Text="Edit"></asp:Button>
When I run this I get
"'T<%# Container.DataItem("PageId") %>' is not a valid identifier"
So, how can I dynamically create webforms/ buttons via ASP.Net?
Thanks in advance
MarkusJ
-
Sep 11th, 2002, 02:59 PM
#2
Hyperactive Member
When I use a datalist (pretty similar to the datareapeter from what i can tell) I bind data from a dataset(or datareader) by doing this.
VB Code:
<%# DataBinder.Eval(Container.DataItem,"FieldName") %>
This works for me. It looks like you just forgot the "DataBinder.Eval()"
-
Sep 11th, 2002, 05:06 PM
#3
Thread Starter
Hyperactive Member
Great, thanks for your help!
Regards
MarkusJ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|