您目前尚未登陆,请选择【登陆】或【注册
首页->功能源码->AjaxControlTookit的ModalPopupExtender弹出应用>>Default.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:AjaxControlTookit的ModalPopupExtender弹出应用
当前文件:文件类型 ModalPopupExtender/Default.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Web; 5using System.Web.Security; 6using System.Web.UI; 7using System.Web.UI.WebControls; 8using System.Web.UI.WebControls.WebParts; 9using System.Web.UI.HtmlControls; 10using System.Data.SqlClient; 11//From bbs.51aspx.com 12public partial class _Default : System.Web.UI.Page 13{ 14 protected void Page_Load(object sender, EventArgs e) 15 { 16 17 } 18 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) 19 { 20 ImageButton btnEdit = sender as ImageButton; 21 GridViewRow row = (GridViewRow)btnEdit.NamingContainer; 22 //this.UpdatePanel1.Update(); 23 this.HiddenField1.Value = row.Cells[0].Text; 24 this.TextBox1.Text = row.Cells[1].Text; 25 this.TextBox2.Text = row.Cells[2].Text; 26 this.ModalPopupExtender1.Show(); 27 } 28 protected void Button1_Click(object sender, EventArgs e) 29 { 30 SqlCommand cmd = null; 31 if ("add" == this.HiddenField1.Value) 32 cmd = new SqlCommand(this.SqlDataSource1.InsertCommand); 33 else 34 cmd = new SqlCommand(this.SqlDataSource1.UpdateCommand); 35 using (cmd) 36 { 37 using (cmd.Connection = new SqlConnection(this.SqlDataSource1.ConnectionString)) 38 { 39 cmd.Connection.Open(); 40 cmd.Parameters.AddWithValue("@name", this.TextBox1.Text); 41 cmd.Parameters.AddWithValue("@des", this.TextBox2.Text); 42 if ("add" != this.HiddenField1.Value) 43 cmd.Parameters.AddWithValue("@id", Convert.ToInt32(this.HiddenField1.Value)); 44 cmd.ExecuteNonQuery(); 45 } 46 } 47 48 this.GridView1.DataBind(); 49 this.ModalPopupExtender1.Hide(); 50 51 } 52 protected void Button4_Click(object sender, EventArgs e) 53 { 54 this.HiddenField1.Value = "add"; 55 this.TextBox1.Text = ""; 56 this.TextBox2.Text = ""; 57 this.ModalPopupExtender1.Show(); 58 } 59}
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:AjaxControlTookit的ModalPopupExtender弹出应用
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号