| |

VerySource

 Forgot password?
 Register
Search
View: 717|Reply: 7

Question about the pop-up dialog?

[Copy link]

1

Threads

18

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-2-7 10:00:01
| Show all posts |Read mode
I want to implement this function:
I have this code in the button's onclick event
if ()
{
respose.write ("<script> alert ('adsdas') </ script>");
}
else if ()
{
I want to realize here that if this condition is met, a whether dialog box can pop up!
}
How to write btn.Attribute.Add ("onclick", "return confirm ('')") in the page_load event
In this case, the event is triggered when the event is clicked.
What should I do?
Reply

Use magic Report

0

Threads

64

Posts

45.00

Credits

Newbie

Rank: 1

Credits
45.00

 China

Post time: 2020-3-27 15:30:02
| Show all posts
respose.write ("<script> alert ('adsdas') </ script>");
Same as this, just replace alert ('adsdas') with js open method
Reply

Use magic Report

0

Threads

23

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-3-27 17:45:01
| Show all posts
protected void ConFirm (System.Web.UI.WebControls.WebControl wc)
{
wc.Attributes.Add ("onclick", "return confirm ('Are you sure of the current operation?')");
}
In if (! Ispostback)
{
ConFirm (control);
}
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-28 09:15:01
| Show all posts
if ()
{
  if (MessageBox.Show ("Are you sure!", "?", MessageBoxButtons.YesNo) == DialogResult.Yes)
  {

  }
}
else if ()
{
if (MessageBox.Show ("Don't confirm it!", "?", MessageBoxButtons.YesNo) == DialogResult.Yes)
  {

  }

}
Reply

Use magic Report

1

Threads

18

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

 Author| Post time: 2020-3-28 15:45:01
| Show all posts
if (MessageBox.Show ("Are you sure!", "?", MessageBoxButtons.YesNo) == DialogResult.Yes)
  {

  }
It seems that someone understands what I mean. The effect I want to achieve is likeyjycoralsaid, but I want to ask if there is any other way.
Reply

Use magic Report

1

Threads

18

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

 Author| Post time: 2020-4-17 19:15:01
| Show all posts
if (MessageBox.Show ("Are you sure!", "?", MessageBoxButtons.YesNo) == DialogResult.Yes)
  {

  }
In this method, it is not very good to pop up a window on the server side
Reply

Use magic Report

0

Threads

15

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-4-20 12:45:01
| Show all posts
/// <summary>
/// Information prompt, provide certain options. Pass value: messagetext, button
/// </ summary>
/// <param name = "messagetext"> </ param>
/// <param name = "mybutton"> </ param>
public void messageokorno (string messagetext, System.Web.UI.WebControls.WebControl mybutton)
{
mybutton.Attributes.Add ("onclick", "return confirm ('" + messagetext + "')");
}

Call directly in Page_Load, such as: messageokorno ("Are you sure you want to refresh the value?", This.Button1);
Reply

Use magic Report

1

Threads

18

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

 Author| Post time: 2020-4-21 02:15:01
| Show all posts
Upstairs is not the same as wc.Attributes.Add ("onclick", "return confirm ('Are you sure to confirm the current operation?')"); The same, the OnClick event of the button that will be executed in this way,
I want to achieve this in the button event:
if ()
{
  if (MessageBox.Show ("Are you sure!", "?", MessageBoxButtons.YesNo) == DialogResult.Yes)
  {

  }
}
else if ()
{
if (MessageBox.Show ("Are you sure?", "?", MessageBoxButtons.YesNo) == DialogResult.Yes)
  {

  }

}
But the above method is not very good, is there any other method
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list