TAGS :Viewed: 2 - Published at: a few seconds ago

[ Prevent refreshing the page after button clicked in vb.net ]

I have a page with a javascript that dynamically create a controls (radio buttons, text boxes) .

on button (submit) I need to validate the values before proceeding with the event it self .

but , after hitting the button I need to cancel the event if one rule didn't obey. but the page gets refreshed and all my dynamic controls goes so I need to stop any action to a page if one of the rules failed . (save the form)

I believe there is a way such as e.preventDefault(); in javascript .

Please Advise, Many Thanks :)

Answer 1

There are many ways to prevent page refresh But we are not certain what you are talking about, so I'll just Give the regular example That I can Find

Fist your e.preventDefault is not for refresh its just prevent link from opening the URL and i.e as per w3school


Now To prevent a page refresh there are too many example Please take a look at the Given link Please take a look