Results 1 to 2 of 2

Thread: Creating controls on the fly at runtime, and databinding them...?

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Creating controls on the fly at runtime, and databinding them...?

    In XML/HTML I can do:
    Code:
    <asp:Label id="lblDescription"  runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'>
    </asp:Label>
    Now...I would like to do this in code behind:
    Code:
    Dim lblDescription As New Label
       lblDescription. ???? How do I add binding here?
       Me.Controls.Add lblDescription
    Is this possible?

    Woka

  2. #2

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Creating controls on the fly at runtime, and databinding them...?

    Hahaha:
    Code:
    lbl.Text = CType(DataBinder.Eval(lbl.DataItem, "AssetName"), String)
    Think that's it.

    WOka

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