Results 1 to 3 of 3

Thread: Dynamically creating webforms using repeater

  1. #1

    Thread Starter
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375

    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

  2. #2
    Hyperactive Member
    Join Date
    May 2001
    Posts
    306
    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:
    1. <%# DataBinder.Eval(Container.DataItem,"FieldName") %>

    This works for me. It looks like you just forgot the "DataBinder.Eval()"

  3. #3

    Thread Starter
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375

    Smile

    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
  •  



Click Here to Expand Forum to Full Width