双击UpdatePanel中的Button怎么没有
protected void Button_Click(object sender, EventArgs e)
{
}
产生??需要手工添加的吗??
主要是想让 UpdatePanel 刷新时就执行如下的一段代码,但 UpdatePane2 刷新时不要执行。
if (GridView1.Rows.Count != 0)
{
string my1 = GridView1.Rows[0].Cells[1].Text.ToString();
string my2 = GridView1.Rows[0].Cells[2].Text.ToString();
string my3 = GridView1.Rows[0].Cells[3].Text.ToString();
string my4 = GridView1.Rows[0].Cells[4].Text.ToString();
String myConnectionString = "Initial Catalog=mysqldatabase;Data Source=localhost;Integrated Security=SSPI; ";
System.Data.SqlClient.SqlConnection myConnection = new System.Data.SqlClient.SqlConnection(myConnectionString);
string myInsertQuery = "INSERT INTO nianji (banji, xingming,zhongfen,huaxue) Values( ' " + my1 + " ', ' " + my2 + " ', ' " + my3 + " ', ' " + my4 + " ') ";
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand(myInsertQuery);
myCommand.Connection = myConnection;
myConnection.Open();
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();
GridView2.DataBind();
正确的做法是什么?谢谢!!!
------解决方案--------------------------------------------------------
双击UpdatePanel中的Button怎么没有
protected void Button_Click(object sender, EventArgs e)
{
}
产生??需要手工添加的吗??
=====================================
不需要手工添加,如果出现这样的问题,请检查你的aspx文件的页面指令
<%@ Page Language= "C# " AutoEventWireup= "true " CodeBehind= "XXX.aspx.cs " Inherits= "后置代码类名 " %>
aspx.cs中
public partial class 类名
aspx.designer.cs
public partial class 类名
看看这三个地方命名空间和类名是否完全一致
------解决方案--------------------------------------------------------
是2005的BUG,2005隐藏了许多设计步骤,最好新建立一个工程
------解决方案--------------------------------------------------------