How to get prompt string from inside EventHandler?

  • Thread starter Thread starter Amelyan
  • Start date Start date
A

Amelyan

Button btn = new Button();
btn.Attributes.Add("onClick", "prompt(\"Enter name\")");
btn.Click += new EventHandler(this.ProcessName);


How do I access string returned by javascript prompt function from inside of
my ProcessName postback event handler?
 
in javascript, store the string in a hidden form field and access it via
REquest.Form.

There's no tie between the javascript onClick and the server-side
handler...you need to write your own (hence the hidden form field)

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top