How to get prompt string from inside EventHandler?

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?
 
K

Karl Seguin

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top