how to stop page refresh on runtime dynamic button click

i have a dynamic(run time created) Button(creating on page load event),  but click on it causes page refresh,
I want no refresh,
any expert plz help
rajeev_23Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Luis PérezConnect With a Mentor Software Architect in .NetCommented:
If you created a server button (System.Web.UI.WebControls.Button), there is no way to got it without postback. Server buttons cause postback always. Anyway, you can detect click on button in javascript and kill the postback from there; but depending on the browser you use, the method for doing this may be different.

But, most important, if you really don't need a postback, it will be much better that you create an HTML input button: no postback ensured.

So, instead of
Dim button As New System.Web.UI.WebControls.Button
do this
Dim button As New System.Web.UI.HtmlControls.HtmlInputButton

Good Luck!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.