|
-
Mar 26th, 2003, 07:51 AM
#1
Thread Starter
Member
Dom + Asp
Hello,
I want to make a DOM file with the content of a form (including
the webcontrols I want to use and the webcontrol sources) Is this possible with DOM?
Then I want to make an aspx file to read the DOM file and build
a dynamic webform. Then I want to save te content (data of the form) as a XML file.
My question : Is it possible to make dynamic forms in ASP.NET by
using the DOM ?
Greeting,
Krol
-
Mar 26th, 2003, 09:47 AM
#2
There is no Document Object Model for aspx pages. ASP is by nature already a dynamic system. So i dont know what you are trying to do beyond what ASP.NET already does.
-
Mar 26th, 2003, 11:02 AM
#3
Thread Starter
Member
dom + asp
First of all thanks for your reaction.
Perhaps I have to explain my question a little more :
I want to 'load' controls and control events dynamic
into an asp form.
I thought that DOM might by of use, but are there other
ways to load controls in a dynamic way into an asp form?
greetings,
Krol
-
Mar 26th, 2003, 11:11 AM
#4
yeah. in the page_load event for the aspx page, you can dynamically load controls. This may not 100% correct, but it might get you started
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim btn As New System.Web.UI.WebControls.Button()
btn.Text = "Yo"
Form1.Controls.Add(btn)
End Sub
-
Mar 26th, 2003, 11:30 AM
#5
Thread Starter
Member
thanks ,
That is the information that I need!
Can I also add the control at a specific location?
greetings,
Krol
-
Mar 26th, 2003, 11:37 AM
#6
if you are using the GridLayout you can use style to specify postioning
like
btn.Style="Z-INDEX: 101; LEFT: 274px; POSITION: absolute; TOP: 145px"
-
Mar 26th, 2003, 11:42 AM
#7
PowerPoster
You also may be able to use placeholder controls to control layout if you want. And instead of using Form1.Controls.Add(), if your using VB.Net, you should use Me.Controls.Add() I believe. This way if you change your form name at a later time, you don't have to go through your code and change all the form names. If you use C#, use this.Controls.Add()
Good luck.
-
Mar 26th, 2003, 11:53 AM
#8
problem is, does Me/this refer to the Page object or the HTML form object?
-
Mar 26th, 2003, 12:13 PM
#9
PowerPoster
Both, at least from my experience.
Look at the code change when you add a server control on the form. There is a instance of it created in the code also. They are mixed together pretty well.
I have used this.Controls.Add() in my C# code a lot so far. No problems yet.
-
Mar 26th, 2003, 12:16 PM
#10
PowerPoster
Here, in the page load even of a blank page, put this in (C#):
LiteralControl lc = new LiteralControl("Hello");
this.Controls.Add(lc);
Or VB.Net (might not be exact on the dim statement):
Dim lc As LiteralControl = New LiteralControl("Hello")
Me.Controls.Add(lc)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|