Mixing Server generated HTML and GUI Design HTML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joatman
    New Member
    • Feb 2008
    • 2

    Mixing Server generated HTML and GUI Design HTML

    I often create web pages where everything I display, such as radio buttons, text boxes and labels, is dynamically generated from the aspx.cs page. At other times I create everything on the aspx page using the GUI designer. I now want to do both. How do I generate something on the backend and put it in a specific place on the page that already has other HTML components?
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by joatman
    I often create web pages where everything I display, such as radio buttons, text boxes and labels, is dynamically generated from the aspx.cs page. At other times I create everything on the aspx page using the GUI designer. I now want to do both. How do I generate something on the backend and put it in a specific place on the page that already has other HTML components?
    Use Panels as your place holders to add your dynamically generated controls.
    Eg:
    [code=asp]
    <!--html content-->
    <asp:Panel runat="server" id="PlaceHolder ForRadioButtons "></asp:Panel>
    <!--more html-->
    <asp:Panel runat="server" id="PlaceHolder ForTextBoxes"></asp:Panel>
    [/code]

    Then you just add your dynamically created controls by calling the Panel.Controls. Add property....

    [code=vbnet]
    '.....dynamical ly created RadioButtonList in code already...
    PlaceHolderForR adioButtons.Con trols.Add(myDyn amicRadioButton s)
    [/code]

    Cheers!

    -Frinny

    Comment

    Working...