Link to home
Start Free TrialLog in
Avatar of Cyart
CyartFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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.

Avatar of jtdebeer
jtdebeer

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
use an input type submit with runat=server, getting post values on the destination page is as easy as :

Request["contolClientId"]
Avatar of Cyart

ASKER

Hello,

I do not have control over the destination page, I also tried the dynamic postback but it didn't seem to work
ASKER CERTIFIED SOLUTION
Avatar of HeoQue
HeoQue

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cyart

ASKER

Yes I need to just thought could use response.redirect and querystring params but did not want to do it that way