Stop navigation to PostbackUrl

Hello experts,
I have a hardcoded the value for the PostbackUrl on a asp button and have some validation and sql calls serverside that conditions have to be met in order to proceed. However, if any of the server side validations fail I do not want to navigate using the PostBackurl. How is this possible?

I want to use Postbackurl as I need to post values to the resulting page.

CyartAsked:
Who is Participating?
 
HeoQueConnect With a Mentor Commented:
ok, then you need to post with naming ? right ?
0
 
jtdebeerCommented:
I suggest you remove the property set for the button and rather set the postbackUrl at runtime

With other words do your validation and then use a statement like below in your buttons on_click event

If Validation = true then
button1.postbackurl = "http://someurl.aspx"
else
button1.postbackurl = "http://someotherurl.aspx"
end if


HTH
Joe
0
 
HeoQueCommented:
use an input type submit with runat=server, getting post values on the destination page is as easy as :

Request["contolClientId"]
0
 
CyartAuthor Commented:
Hello,

I do not have control over the destination page, I also tried the dynamic postback but it didn't seem to work
0
 
CyartAuthor Commented:
Yes I need to just thought could use response.redirect and querystring params but did not want to do it that way
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.