469,955 Members | 2,544 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,955 developers. It's quick & easy.

Popup dialog page

Hello,

I have some codes under event ButtonSend_Click to check the user input
values. This check is complicated enough using different stored procedures.
Then according the result of the checks, I would like to display a popup
page in which the user can select "OK", "Cancel" etc.

Now I created a javascript function doDialog() in HTML page to open a popup
page. I would like to call this function from the code behind page. I
cannot use onclick event with ButtonSend because I have lots of checks to do
before calling doDialog() function and this function should be called only
under certain test results. Also, I have to carry as a parameter different
message texts depending on the test results to display on the popup page.

Thank you for your kind advice,

Kiyomi
Jan 3 '06 #1
2 1855
I'm not sure I understand you fully. It sounds like you have a Button
Control that causes a server-side Click event to happen. The event handler
performs some processing, and you want to add a JavaScript popup window to
the page afterwards. Am I following you so far?

The place where I lose you is where you talk about not using the Click event
handler to add the JavaScript to the page. The JavaScript to open the Popup
window would be added on the server side, and all of the information you
need to display in the popup window should be available at the end of your
event handler method. So, all you need to do is add the JavaScript to the
Page at the end of the event handler, using Page.RegisterStartupScript. What
is the problem?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Kiyomi" <k.*******@unesco.org> wrote in message
news:OF**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have some codes under event ButtonSend_Click to check the user input
values. This check is complicated enough using different stored
procedures.
Then according the result of the checks, I would like to display a popup
page in which the user can select "OK", "Cancel" etc.

Now I created a javascript function doDialog() in HTML page to open a
popup
page. I would like to call this function from the code behind page. I
cannot use onclick event with ButtonSend because I have lots of checks to
do
before calling doDialog() function and this function should be called only
under certain test results. Also, I have to carry as a parameter
different
message texts depending on the test results to display on the popup page.

Thank you for your kind advice,

Kiyomi

Jan 3 '06 #2
Thank you, Kevin, for your reply. I tried to look at the documation and
exmples for Page.RegisterStartupScript, but I don't think I really
understand how I can adapt it to my case.

I have the following code behinde page (all the checks are simplified) which
is perfectly working fine. What I would like to do is to replace the error
messages (lblError) with a popup page (popup.htm).

Would it be possible ?

Thank you,

Kiyomi

********************* vb *************************

Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnOK.Click

CheckRules()

End Sub

Private Function CheckRules()

If txtInput.Text = "" Then

lblError.Text = "You must enter your age"

Return False

Exit Function

End If

If IsNumeric(txtInput.Text) Then

'do nothing

Else

lblError.Text = "The format is not correct"

Return False

Exit Function

End If

If Convert.ToInt16(txtInput.Text) < 20 Or
Convert.ToInt16(txtInput.Text) > 60 Then

lblError.Text = "Your age must between 20 and 60"

Return False

Exit Function

End If

lblConfirm.Text = "The information has been registered"

Return True

End Function

*************************** HTML **********************

<script>

function doDialog()

{

if (Form1.lblError.value != "" )

{ var x=showModalDialog('popup.htm', Form1.lblError.value,
'status:no;resizable:yes'); }

}

</script>

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
I'm not sure I understand you fully. It sounds like you have a Button
Control that causes a server-side Click event to happen. The event handler
performs some processing, and you want to add a JavaScript popup window to
the page afterwards. Am I following you so far?

The place where I lose you is where you talk about not using the Click event handler to add the JavaScript to the page. The JavaScript to open the Popup window would be added on the server side, and all of the information you
need to display in the popup window should be available at the end of your
event handler method. So, all you need to do is add the JavaScript to the
Page at the end of the event handler, using Page.RegisterStartupScript. What is the problem?

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Kiyomi" <k.*******@unesco.org> wrote in message
news:OF**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have some codes under event ButtonSend_Click to check the user input
values. This check is complicated enough using different stored
procedures.
Then according the result of the checks, I would like to display a popup
page in which the user can select "OK", "Cancel" etc.

Now I created a javascript function doDialog() in HTML page to open a
popup
page. I would like to call this function from the code behind page. I
cannot use onclick event with ButtonSend because I have lots of checks to do
before calling doDialog() function and this function should be called only under certain test results. Also, I have to carry as a parameter
different
message texts depending on the test results to display on the popup page.
Thank you for your kind advice,

Kiyomi


Jan 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Marco Antonio Montalvo Durán | last post: by
4 posts views Thread by SteveS | last post: by
4 posts views Thread by fran_j_diaz | last post: by
3 posts views Thread by Mike Hofer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.