How can I display a MessageBox in ASP.NET?

  • Thread starter Thread starter Steve Kershaw
  • Start date Start date
S

Steve Kershaw

Hi,

I need to display a messagebox in ASP.NET that includes a textbox for
input. There must be an easy way to do this!

Thanks
Steve
 
this is known as a popup in the html world. current browser security
requires this to be done from client script in response to click event.

<a href="javascript:window.open('mypopup.aspx');">click here</a>

to move data from the popup to the main window also requires javascript. you
should buy a book on javascript programing if this is the direction you want
to go.

-- bruce (sqlwork.com)
 
Standard message box in a webbrowser is a javascript alert, standard
inputbox is a javascript prompt. So you need a javascript function to do it
which you can output.

<SCRIPT language="JavaScript">
<!--hide
var yourname= prompt('Please enter your name, so you can get a special
greeting', ' ');

if ( (yourname==' ') || (yourname==null) )
{
yourname="Dude";
}

//-->
</SCRIPT>
Take a look here to see how to implement javascript functions in asp.net
http://steveorr.net/articles/ClientSideSuite.aspx
 
Thanks for your quick response.

JavaScript has the problem that it is completely client side and I need
to call a server side method with the user input. I need something like
btnMyButton.Attributes.Add("onclick", "return confirm('Do you really
want to do this?')"); Except the confirm popup dosen't have a textbox
for user input.
 
Steve Kershaw said:
Hi,

I need to display a messagebox in ASP.NET that includes a textbox for
input. There must be an easy way to do this!

Create a new web form that simulates the popup box and display it from your
code. You can use HTML or Javascript to ensure it opens in a new window.
 
Back
Top