Results 1 to 10 of 10

Thread: Dom + Asp

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2003
    Posts
    33

    Post 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

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2003
    Posts
    33

    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

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2003
    Posts
    33
    thanks ,

    That is the information that I need!

    Can I also add the control at a specific location?


    greetings,

    Krol

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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"
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  7. #7
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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.

  8. #8
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    problem is, does Me/this refer to the Page object or the HTML form object?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  9. #9
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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.

  10. #10
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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
  •  



Click Here to Expand Forum to Full Width