More in this section

Forums / Developing with Sitefinity / Site Finity Generic Content with ASP.NET Controls?

Site Finity Generic Content with ASP.NET Controls?

3 posts, 0 answered
  1. Armysniper
    Armysniper avatar
    126 posts
    03 Mar 2005
    16 Jul 2009
    Link to this post
    Is it possible to add an ASP.NET control, such as a button, into a piece of Generic Content and have it render?

    I have a form that I need to put in on every page that looks like this:

    <h2>Subscribe to Leadership Matters </h2>
    <p>Submit your email to receive our monthly newsletter dedicated to career and recruiting related topics. </p>
    <div style="text-align: left;">
    <div style="background-color: #ffffff; width: 226px; height: 70px;">
    <form style="margin-bottom: 1px;" method="post" name="ccoptin" action="" target="_blank">
        <span style="background-color: #006699; margin-top: 2px; float: left; margin-left: 2px; margin-right: 2px;"><img alt="" style="border-bottom: 0px solid; border-left: 0px solid; border-top: 0px solid; border-right: 0px solid;" src="" /></span><input style="border-bottom: #999999 1px solid; border-left: #999999 1px solid; font-family: verdana,geneva,arial,helvetica,sans-serif; border-top: #999999 1px solid; border-right: #999999 1px solid;" type="text" name="ea" /> <input style="font-family: verdana,arial,helvetica,sans-serif; font-size: 10px;" class="submit" value="GO" type="submit" name="go" /> <br />

    Instead of the Button input I want to use an ASP:Button control to avoid using the FORM tag (since ASP.NET does not support multiple form tags). Problem is when I do this, the button is not rendered. How can I do this?
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    18 Jul 2012
    17 Jul 2009
    Link to this post
    If you mean the generic content control which you drop onto a page, I don't beleive this is possible, because as you pointed out, you can't use multiple forms inside the main aspnet form...

    however, if you do need this on every page, why not place it in a UserControl and drop that on each required page, or better yet, add your code to the site's master page?

    Alternatively, you could use the asp:button as set the PostBackUrl property so that if someone clicks that button, it will post to your required page.

    I hope I understood your question correctly, and that you found this helpful!
  3. Georgi
    Georgi avatar
    3583 posts
    28 Oct 2016
    17 Jul 2009
    Link to this post

    SelArom is right. The problem with the asp:Button inside of the GenericContent, the markup itself will be rendered. The button is a server side control which will not be processed by the Asp.Net runtime in this case.

    I too suggest you going with a User Control.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
3 posts, 0 answered