不可能的,linkbutton也要刷新页面!看看你的代码,是不是没有处理linkbutton事件?

解决方案 »

  1.   

    不好意思,刚才改代码,
    我也很纳闷,主要代码如下:
    aspx<asp:datagrid id="mydg" runat="server" OnItemCommand="mydg_command" AutoGenerateColumns="False" AllowPaging="True" PageSize="5" OnPageIndexChanged="mydg_Changed" CellPadding="4" BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#3366CC" DataKeyField="news_id">
    <asp:ButtonColumn Text="删除" CommandName="Delete"></asp:ButtonColumn>.cspublic void mydg_command(object sender,System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
       string id;
       id=mydg.DataKeys[e.Item.ItemIndex].ToString();

        if(e.CommandName=="Delete")
    {
    string sql="delete * from news where news_id='"+id+"'";
    OleDbConnection mycon=new OleDbConnection(Application["strconn"].ToString());
    mycon.Open();
    OleDbCommand mycom=new OleDbCommand(sql,mycon);
    mycom.ExecuteNonQuery();
    mycon.Close();
    BindData();
    }是不是跟我前面定义的按钮有关????
     private void mybtn_Click(object sender, System.EventArgs e)
    {
    Response.Redirect("news_content_add.aspx?type="+ViewState["type_id"].ToString());
    }
    谢谢了,帮忙看看了,各位!