Programically nesting a repeater

Discussion in 'ASP .Net Web Controls' started by Nikerz Inc, May 22, 2004.

  1. Nikerz Inc

    Nikerz Inc Guest

    I would like to programically nest a repeater to do the following. The
    tricky part is linking the data to these controls. I've been able to do
    this coding the straight html which I would like to do away with because I
    want to be able to change the control that appears as well.

    Any help please!!!!

    -----------------------------------------------------
    Data 1 Radiobutton (text)
    Radiobutton (text)
    Radiobutton (text)
    -----------------------------------------------------
    Data 2 Checklist (text)
    Checklist (text)
    Checklist (text)
    -----------------------------------------------------


    Public Class MyTemplate

    Implements ITemplate

    Shared itemcount As Integer = 0

    Dim TemplateType As ListItemType

    Sub InstantiateIn(ByVal container As Control) _

    Implements ITemplate.InstantiateIn

    Dim lc As New Literal

    lc.Text = "<br>"

    AddHandler lc.DataBinding, AddressOf TemplateControl_DataBinding

    itemcount += 1

    container.Controls.Add(lc)

    End Sub

    Private Sub TemplateControl_DataBinding(ByVal sender As Object, _

    ByVal e As System.EventArgs)

    Dim lc As Literal

    lc = CType(sender, Literal)

    Dim container As RepeaterItem

    container = CType(lc.NamingContainer, RepeaterItem)

    lc.Text &= DataBinder.Eval(container.DataItem, "Response")

    End Sub

    End Class
     
    Nikerz Inc, May 22, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Perot
    Replies:
    6
    Views:
    685
    Randy Weber
    Dec 9, 2003
  2. sck10
    Replies:
    1
    Views:
    387
    Steven Cheng[MSFT]
    May 31, 2006
  3. dtarczynski
    Replies:
    2
    Views:
    950
    dtarczynski
    Sep 7, 2006
  4. Tomas

    replace tag value programically

    Tomas, Dec 1, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    377
    Tomas
    Dec 1, 2008
  5. Trans
    Replies:
    10
    Views:
    305
    Sean O'Halpin
    Sep 16, 2005
Loading...

Share This Page