help needed with popup window

  • Thread starter Thread starter David Cho
  • Start date Start date
D

David Cho

I am trying to use the server side code to have a popup window come up only
under a certain condition.

For example, the user presses a button to retrieve a set of records. So

- If there are records to be retrieved, then display the records in a
datagrid
- If there aren't any, then show in the pop up window that there aren't any
to display.

The problem with setting the "OnClick" attribute of the button to the alert
java script is that, I cannot make it conditional. It will launch the pop
up window no matter what.
 
David said:
The problem with setting the "OnClick" attribute of the button to the
alert java script is that, I cannot make it conditional. It will
launch the pop up window no matter what.

Hello David,

As you said, you're trying to use _server_side_code_ to get a popup
window to come up only under a certain condition, so the "OnClick"
attribute of the button is not the right place to look.
This attribute is for setting the _client_side_ event handler.

A way to achieve what you want is to put some code in the
server side handler for the button Click event, that checks
whether there are records and if there aren't any,
dynamically add a LiteralControl, containing the JavaScript
that pops up the window, to the Page's Control collection.

Best regards,

Eric
 
Back
Top