This is a migrated thread and some comments may be shown as answers.

Make SkinnedButton as type="Submit"

5 Answers 180 Views
Button
This is a migrated thread and some comments may be shown as answers.
miksh
Top achievements
Rank 1
Iron
miksh asked on 27 Mar 2014, 05:21 PM
Is there a way to render a ButtonType="SkinnedButton" as <input type="submit"> ?

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Mar 2014, 06:18 AM
Hi miksh,

Please try the following code snippet which works fine at my end.

ASPX:
<telerik:RadButton ID="RadButton1" runat="server" Text="Submit" ButtonType="SkinnedButton">
</telerik:RadButton>

JavaScript:
<script type="text/javascript">
    function pageLoad() {
        var elements = document.getElementsByTagName("span");
        for (var i = 0; i < elements.length; i++) {
            if (elements[i].className == "RadButton RadButton_Default rbLinkButton rbRounded") {
                elements[i].outerHTML = "<input type='submit' value='Submit'>";
            }
        }
    }
</script>

Thanks,
Shinu.
0
miksh
Top achievements
Rank 1
Iron
answered on 28 Mar 2014, 11:55 AM
Thanks, it works.
Any reason why UseSubmitBehaviour ignored for this type of button?
0
Danail Vasilev
Telerik team
answered on 01 Apr 2014, 12:34 PM
Hello Miksh,

The reason why the UseSubmitBehavior property is available only for ButtonType="StandardButton" is because of the different button type rendering:

  - ButtonType="StandardButton" is rendered as an input element wrapped inside a span element. When the UseSubmitBehavior property is set to true(i.e., default value) the input is of type "submit", so that the the button uses the browser submit mechanism. If the UseSubmitBehaviors property, however, is set to false, the input is of type "button", so that the button uses the ASP.NET postback mechanism.
 
  - ButtonType="SkinnedButton" or "LinkButton" - The button is rendered as a span element wrapped inside another span, so that there is no input rendered and therefore the UseSubmitBehavior has not meaning here.

Regards,
Danail Vasilev
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
miksh
Top achievements
Rank 1
Iron
answered on 07 Apr 2014, 02:33 PM
[quote]Danail Vasilev said:  - ButtonType="SkinnedButton" or "LinkButton" - The button is rendered as a span element wrapped inside another span, so that there is no input rendered and therefore the UseSubmitBehavior has not meaning here.
 [/quote]

As per your demo at http://demos.telerik.com/aspnet-ajax/button/examples/overview/defaultcs.aspx the skinned button does contain an input.

Btw, would it be much easier to render such a skinned button as a single <button> with appropriate class?

<span tabindex="0" class="RadButton RadButton_Silk rbLinkButton rbRounded" id="ctl00_ContentPlaceHolder1_btnStandard"><span class="rbText">Skinned Button</span><input name="ctl00_ContentPlaceHolder1_btnStandard_ClientState" id="ctl00_ContentPlaceHolder1_btnStandard_ClientState" type="hidden" autocomplete="off"></span>
0
Danail Vasilev
Telerik team
answered on 08 Apr 2014, 01:57 PM
Hi Miksh,

You are right that the demo must be updated, so that the UseSubmitBehavior property is available only for the StandardButton type.

Regarding your question about the skinned button rendering, this button type is based on the rendering of ButtonType="LinkButton" that also doesn't render an input. What has the skinned button compared to the link button is additional CssClasses and CSS3 (e.g., border radius, gradient, etc.). If we change, however, the rendering of the skinned button, for example to button HTML element this would be a breaking change that is not currently required.

If you want the input type=submit to look like the skinned button, you can use the RadButton's styles. For example:
ASPX:
<telerik:RadButton ID="RadButton1" runat="server" ButtonType="SkinnedButton" Text="click" />
<input type="submit" value="click" class="RadButton RadButton_Default rbLinkButton rbRounded rbCustomSubmit" />
CSS:
<style>
    input.rbCustomSubmit {
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        height: 1.833em;
    }
</style>



Regards,
Danail Vasilev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Button
Asked by
miksh
Top achievements
Rank 1
Iron
Answers by
Shinu
Top achievements
Rank 2
miksh
Top achievements
Rank 1
Iron
Danail Vasilev
Telerik team
Share this question
or