Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Dynamic Controls using ParseControl

Reply
Thread Tools

Dynamic Controls using ParseControl

 
 
Bhagwati
Guest
Posts: n/a
 
      03-02-2004
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using ParseControl and Subsequently Getting Specific Control Type Jordan S. ASP .Net 1 05-23-2008 07:20 PM
ParseControl With Multiple Controls in One Input String PB ASP .Net 0 05-30-2005 07:57 PM
Using ParseControl at Design-Time Kristof Berger ASP .Net Web Controls 0 05-24-2005 03:42 PM
Dynamic controls using Parsecontrol methos Bhagwati ASP .Net Web Controls 1 03-02-2004 08:31 AM
Using Validation Controls with Page.ParseControl Matthias Lohrer ASP .Net 1 07-29-2003 12:31 PM



Advertisments