0

By definition LinkButton seems to invoke a javascript function which causes the script to freeze if I have disabled javascript. In such case the Button_Click event isn't even triggered.

Is there a quick and simple way to ignore the javascript generated for my LinkButton? I want the Button_Click event to execute when my button is click with js disabled.

0

1 Answer 1

1

LinkButton generates an <a> so it cannot post without js. Making LinkButton work without js creates an unnecessary massive workaround.

A better solution is to style Button as a link. This was tested on Chrome, FF, IE8+, Edge:

    input[type="submit"], input[type="submit"]:focus, input[type="submit"]:active {
        /* Remove all decorations to look like normal text */
        background: none;
        border: none;
        display: inline;
        font: inherit;
        margin: 0;
        padding: 0;
        outline: none;
        outline-offset: 0;
        /* Additional styles to look like a link */
        color: blue;
        cursor: pointer;
        text-decoration: underline;
    }

    /* Remove extra space inside buttons in Firefox */
    input[type="submit"]::-moz-focus-inner {
        border: none;
        padding: 0;
    }

    // Markup
    <asp:Button runat="server" ID="btnTest" Text="Click" OnClick="btnTest_Click" />
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.