Dynamic Controls using ParseControl

Discussion in 'ASP .Net Building Controls' started by Bhagwati, Mar 2, 2004.

  1. Bhagwati

    Bhagwati Guest

    Hello everybody,
    I am using xml and xslt to generate dynamic asp
    server controls on the page. What I do is I store the control type and their
    attributes in the database. And then using xml, i retrieve those controls
    and then using xslt transform method , i get a stream object. I convert it
    into string and pass it to the parsecontrol method in the page_init method.
    All works fine, but the problem is that the server side events are not
    handled. I somehow need to wire the events to the control, I dont how to go
    abt it ? If u have come up across this or u have any ideas ,plz do reply.

    Regards,
    Bhagwati

    The code for the page_init is
    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Init

    Dim surveyDoc As XPathDocument

    Dim transform As XslTransform

    Dim survey As New PlaceHolder()

    Dim sw As StringWriter

    surveyDoc = New XPathDocument(Server.MapPath("xmlfile1.xml"))

    transform = New XslTransform()

    transform.Load(Server.MapPath("xsltfile1.xslt"))

    sw = New StringWriter()

    transform.Transform(surveyDoc, Nothing, sw)

    Dim result As String

    result = sw.ToString()

    result = result.Replace("xmlns:asp=""remove""", " ")

    Dim ctrl As Control

    ctrl = Page.ParseControl(result)

    Me.PlaceHolder1.Controls.Add(ctrl)

    InitializeComponent()

    End Sub
     
    Bhagwati, Mar 2, 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. Matthias Lohrer

    Using Validation Controls with Page.ParseControl

    Matthias Lohrer, Jul 29, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,622
    Satish Appasani
    Jul 29, 2003
  2. PB
    Replies:
    0
    Views:
    610
  3. Jordan S.
    Replies:
    1
    Views:
    418
    Jordan S.
    May 23, 2008
  4. Bhagwati

    Dynamic controls using Parsecontrol methos

    Bhagwati, Mar 2, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    209
    Teemu Keiski
    Mar 2, 2004
  5. Kristof Berger

    Using ParseControl at Design-Time

    Kristof Berger, May 24, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    153
    Kristof Berger
    May 24, 2005
Loading...

Share This Page