?? default.aspx.cs
字號:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
ImageButton btnEdit = sender as ImageButton;
GridViewRow row = (GridViewRow)btnEdit.NamingContainer;
//this.UpdatePanel1.Update();
this.HiddenField1.Value = row.Cells[0].Text;
this.TextBox1.Text = row.Cells[1].Text;
this.TextBox2.Text = row.Cells[2].Text;
this.ModalPopupExtender1.Show();
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmd = null;
if ("add" == this.HiddenField1.Value)
cmd = new SqlCommand(this.SqlDataSource1.InsertCommand);
else
cmd = new SqlCommand(this.SqlDataSource1.UpdateCommand);
using (cmd)
{
using (cmd.Connection = new SqlConnection(this.SqlDataSource1.ConnectionString))
{
cmd.Connection.Open();
cmd.Parameters.AddWithValue("@name", this.TextBox1.Text);
cmd.Parameters.AddWithValue("@des", this.TextBox2.Text);
if ("add" != this.HiddenField1.Value)
cmd.Parameters.AddWithValue("@id", Convert.ToInt32(this.HiddenField1.Value));
cmd.ExecuteNonQuery();
}
}
this.GridView1.DataBind();
this.ModalPopupExtender1.Hide();
}
protected void Button4_Click(object sender, EventArgs e)
{
this.HiddenField1.Value = "add";
this.TextBox1.Text = "";
this.TextBox2.Text = "";
this.ModalPopupExtender1.Show();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -