Generate Server Controls at Runtime

Discussion in 'ASP .Net Web Controls' started by Jeffrey Jones, Dec 15, 2005.

  1. Hello All,

    I am trying to develop a web app that will allow a user to upload files
    to a folder. I have an xml file that allows a person to add or delete a
    file. Basic format follows.
    <files>
    <file>
    <label>Map:</label>
    <extension>pdf</extension>
    <endname>Map</endname>
    <multiple>0</multiple>
    <sec_group>1</sec_group>
    <section>1</section>
    </file>
    </files>

    I also have an XSLT file that transforms the XML into HTML Controls.
    Format follows.
    <xsl:template match="/">
    <table cellSpacing="0" cellPadding="4" rules="groups">
    <xsl:for-each select="//file">
    <asp:panel id="pnl{endname}" runat="server">
    <tr>
    <td><b><xsl:value-of select="label" /></b></td>
    <td><input type="file" id="browse{endname}" runat="server" /></td>
    <td><asp:button id="submit{endname}" runat="server" text="Submit" /></td>
    <td><asp:hyperlink id="display{endname}" runat="server">Current File: NO
    DATA</asp:hyperlink></td>
    </tr>
    </asp:panel>
    </xsl:for-each>
    </table>
    </xsl:template>

    So far I can create the controls at runtime and can even add a
    javascript onclick event to the submit button. What I can't seem to do
    is add a Server side event to the submit button. Has anyone run into
    this problem? Should I just read the XML file into an XML doc and add
    the controls to the page at runtime instead of using XSLT? If I choose
    this method, how do I add the logic to the buttons to handle the click
    event?

    Thanks for your advice.

    Jeff Jones
    Jeffrey Jones, Dec 15, 2005
    #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. Weng Tianxiang
    Replies:
    5
    Views:
    1,308
    Christophe
    Feb 16, 2006
  2. newbye
    Replies:
    0
    Views:
    578
    newbye
    Jul 6, 2006
  3. Replies:
    3
    Views:
    407
    red floyd
    Apr 7, 2006
  4. Harlan Messinger
    Replies:
    2
    Views:
    2,291
    John Bell
    Mar 28, 2010
  5. Stephen Miller
    Replies:
    7
    Views:
    645
    John Saunders
    Aug 6, 2003
Loading...

Share This Page