Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need a requirement like

1.I need to call javascript to confirm popup box from code file.
2.I need to get the result from the java script.
3.Based on the result, I need to display some content on the Page.

The problem is
1. Before getting the input from pop up box, my code gets executesd.
2. I need to stop the process until or unless user updates the pop up box.

Moved from OP's answer:
C#
protected void Button1_Click(object sender, EventArgs e)
{
  String csname = "PopupScript";
  Type cstype = this.GetType();
  ClientScriptManager cs = Page.ClientScript;
  if (!cs.IsStartupScriptRegistered(cstype, csname))
  {
    String cstext = "confirmProcess()";
    cs.RegisterStartupScript(cstype, csname, cstext, true);
  }
  else
  {
    Response.Write("Process OK");
  }
  Label1.Text = "hello";
}

Here label.text is assigned with "hello" before user clicks ok or cancel button.
Posted
Updated 5-Jan-11 21:35pm
v3
Comments
Rajesh Anuhya 6-Jan-11 0:10am    
Are you started anything???
Sunasara Imdadhusen 6-Jan-11 0:18am    
Rajesh you are right.
Shivkumar, you should try yourself. if you are stuck anywhere the fill free to ask.
JF2015 6-Jan-11 0:19am    
Edited to move OP's answer to the question.
Dalek Dave 6-Jan-11 3:35am    
Edited for Spelling, Syntanx and Grammar.

There are more simple ways with JavaScript , If you want the same with JavaScript then refer here[^] .
Its explained for deleting a record but you can change according to your usage.
A simple googling will give you a screen full of reference links[^]
 
Share this answer
 
v2
Comments
Dalek Dave 6-Jan-11 3:36am    
Good Answer.
hi sivakumar from nuware,:thumbsdown:


just you pass the ID to javascript. Then, u get the value from the page also further process u continue on the page.

if u get the value from the page then, u use the method in javascript

document.GetElementById();
 
Share this answer
 
Comments
Dalek Dave 6-Jan-11 3:36am    
Seems Reasonable.
velmahesh 6-Jan-11 7:34am    
this is a proper method pass the value to script.
do u try pass the value to script ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900