U
usl2222
Hi folks,
I appreciate any assistance in the following problem:
I have a form with a bunch of dynamic controls on it. All the controls
are dynamically generated on a server, including all the validators.
The user enters the data, presses OK. My OK button is dynamically
generated as well, with some code-behind logic in
it's click event. CausesValidation property is set to false, since all
my validators are dynamic anyways,
and I do all my validation on a server. In the beginning of an
OK_click event, I call page validate explicitly:
Page.Validate();
if (!IsValid) return;
So far, so good. Now, in the beginning of my OK logic, I need to call
some javascript function, that will take some parameters,
call Modal Dialog and return some parameters to the server.
I attached this function to form OnSubmit event:
<form id="Form1" method="post" runat="server" onsubmit="test()">
Everything is great, I'm able to call the function that calls modal
dialog, grab a return value, set it
to a hidden field, and pick it up on a server.
The only one thing that I cannot figure out how to do, is: I want my
function to be called only AFTER the
validation, and only if validation is correct. I cannot figure out how
it do it, and if its possible.
My function keeps getting called before the validation.
I searched on the internet about this problem, and it seems like
people who had it and successfully resolved
it, all had client-side validation. But I have a server-side
validation.
I tried to mess with different things, like putting the javascript
function call in ResponseWrite, or
registering it with RegisterClientScript and
then calling it explicitly after Page.Validate(), but it doesn't work
anyway, it's even worse, because, now
javascript is executed in the very beginning of the form, before all
the controls are created, so I don't
have my hidden field control yet, to pass the information to the
server.
Is there any way? I appreciate your time, folks.
(e-mail address removed)
I appreciate any assistance in the following problem:
I have a form with a bunch of dynamic controls on it. All the controls
are dynamically generated on a server, including all the validators.
The user enters the data, presses OK. My OK button is dynamically
generated as well, with some code-behind logic in
it's click event. CausesValidation property is set to false, since all
my validators are dynamic anyways,
and I do all my validation on a server. In the beginning of an
OK_click event, I call page validate explicitly:
Page.Validate();
if (!IsValid) return;
So far, so good. Now, in the beginning of my OK logic, I need to call
some javascript function, that will take some parameters,
call Modal Dialog and return some parameters to the server.
I attached this function to form OnSubmit event:
<form id="Form1" method="post" runat="server" onsubmit="test()">
Everything is great, I'm able to call the function that calls modal
dialog, grab a return value, set it
to a hidden field, and pick it up on a server.
The only one thing that I cannot figure out how to do, is: I want my
function to be called only AFTER the
validation, and only if validation is correct. I cannot figure out how
it do it, and if its possible.
My function keeps getting called before the validation.
I searched on the internet about this problem, and it seems like
people who had it and successfully resolved
it, all had client-side validation. But I have a server-side
validation.
I tried to mess with different things, like putting the javascript
function call in ResponseWrite, or
registering it with RegisterClientScript and
then calling it explicitly after Page.Validate(), but it doesn't work
anyway, it's even worse, because, now
javascript is executed in the very beginning of the form, before all
the controls are created, so I don't
have my hidden field control yet, to pass the information to the
server.
Is there any way? I appreciate your time, folks.
(e-mail address removed)