NavigateUrl

5 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 12 Jun 2011 Link to this post

    Is there any way to have the button look like the cool skinned buttons while giving me NavigateUrl?...instead of the button falling back to the LinkButton look when NavURL is used?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Jun 2011 Link to this post

    Hello Steve,

    As far as I know there is no easy way to make both link buttons and standard buttons to appear the same way having the standard button look and feel. They have different rendering depending on their front-end requirements. One suggestion is to create custom skin for the RadButton.

    Please go through the following tutorial for more on creating custom skin.
    Creating a Custom Skin for RadButton

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 13 Jun 2011 Link to this post

    Hi Steve,

    If you handle the client-side event OnClientClicking you can keep the button look without having to change the ButtonType property to LinkButton. In the event handler you must open with Javascript the URL, specified in the NavigateUrl property and after that you should cancel the event and postback.

    Below is a sample, showing how to achieve this:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ButtonRedirect.aspx.cs" Inherits="ButtonRedirect" %>
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
     
            <script type="text/javascript">
                function OnClientClicking(button, args) {
                    window.location = button.get_navigateUrl();
                    args.set_cancel(true);
                }
            </script>
     
            <telerik:RadButton ID="RadButton" runat="server" Text="RadButton" NavigateUrl="http://www.telerik.com/" OnClientClicking="OnClientClicking">
            </telerik:RadButton>
        </div>
        </form>
    </body>
    </html>


    Regards,
    Slav
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. Tom
    Tom avatar
    44 posts
    Member since:
    Oct 2010

    Posted 18 Jul 2014 in reply to Slav Link to this post

    Thanks for the code--this is super helpful.
  6. kengsheng
    kengsheng avatar
    1 posts
    Member since:
    Sep 2014

    Posted 11 Sep 2014 in reply to Slav Link to this post

    This is super helpful and simple! Thank you very much! =D
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017