| |

VerySource

 Forgot password?
 Register
Search
View: 661|Reply: 3

How to manipulate dialogs and control programs in .NET

[Copy link]

3

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-10 17:30:01
| Show all posts |Read mode
private void DataGrid1_DeleteCommand (object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
Ranch
try
{
string Con = ConfigurationSettings.AppSettings ["Conn"];
con = new SqlConnection (Con);
c = new Blog.classes.Classtx ();
Ranch
cmd = new SqlCommand ("delete Blog_UAddrClass where sid = @ sid", con);
cmd.Parameters.Add (new SqlParameter ("@ sid", SqlDbType.Int));

cmd.Parameters ["@ sid"]. Value = this.DataGrid1.DataKeys [(int) e.Item.ItemIndex];
Ranch
Response.Write ("<script language = javascript> confirm ('Are you sure you want to delete?') </ Script>"); // When I want to operate it, I will let it delete, otherwise I will do nothing

if (c.rowcout (Convert.ToInt32 (DataGrid1.DataKeys [(int) e.Item.ItemIndex])))> 0&&c.classnamecout (Session ["Username"]. ToString ())> 1)
{
Response.Redirect ("deletedata.aspx? Sid =" + DataGrid1.DataKeys [(int) e.Item.ItemIndex] .ToString () + "&rowcount =" + c.rowcout (Convert.ToInt32 (DataGrid1.DataKeys [(int ) e.Item.ItemIndex])));
Ranch
}
else
{
Ranch
c.delete (Convert.ToInt32 (DataGrid1.DataKeys [(int) e.Item.ItemIndex]));
Ranch
}
cmd.Dispose ();
con.Close ();
        
c.bindGraid (this.DataGrid1, Session ["Username"]. ToString ());
}
Ranch
catch (Exception ex)
{
             Ranch
}
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-6-6 13:45:01
| Show all posts
Use template columns
if(confirm())
{

}
Reply

Use magic Report

0

Threads

23

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-6-6 16:45:01
| Show all posts
protected void ConFirm(System.Web.UI.WebControls.WebControl wc)
{
wc.Attributes.Add("onclick","return confirm('Are you sure about the current operation?')");
}
Call this method in if(!ispostback)
Reply

Use magic Report

0

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-6-8 16:30:01
| Show all posts
private void dgContent_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
     Buttom lb = e.FindControl('btnDelete');
     lb.Attributes.Add("onclick", "return confirm('&Auml;ú&Otilde;&aelig;&micro;&Auml;&Ograve;&ordf;&Eacute;&frac34;&sup3;&yacute;&;&;&;&;&;&; ;&iquest;')");
}
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