i want to use an asp:LinkButton
, since it looks like a link, yet also has server-side Click handler.
But the web-server seems unable to detect if javascript is disabled on the client, and doesn't render into a mechanism that still works.
Is it possible to have a link that looks like a link, but has server-side OnClick event handler?
The answer is no, but below are some workaround ideas. Accepted the one with non-zero up-votes.
getElementById("LinkButton1"). disabled = false;)
Answers. you can't hide linkbutton using javascript , if your page is post back on any event, link button will appear again. make sure if you want your button click / any event to fired on sever, this will not give required result......
You could use CSS to style a button to look like a link, but this will be very much browser dependant, depending on the CSS implementation.
Edit: I feel compelled to complete my answer since it's been accepted.
An asp:LinkButton
renders to an HTML link, and as such cannot post to a web page; but can only make get requests. To work around this MS use JavaScript to action the post. This is not possible however if Javascript is disabled.
asp:Button
and asp:ImageButton
are different. They submit the HTML form by posting to a web page (or get depending on the form attributes) by using true HTML form elements. So these will work without JS intervention.
Some browsers will allow CSS styling to style a button to look like a link, and as such this can be used to work around the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With