bcm
bcm

Reputation: 5500

Can I validate and submit a form by a hyperlink control in C#.net?

Possible to use a link control to validate and submit a form? What would be the code to tie the click event of the link control to the submission functions? (I prefer link buttons much more than input buttons for styling across browsers.)

Upvotes: 0

Views: 1131

Answers (1)

Nick Craver
Nick Craver

Reputation: 630559

There's a control built in for this: LinkButton.

Instead of <asp:Button /> use <asp:LinkButton /> to render an <a ... /> link, style it as you wish :)

You use it the same way as you do a Button control, assign a handler to it's OnClick event, etc, whatever you need to do. The handling from your code's perspective is very similar, identical in most cases.

Upvotes: 1

Related Questions