在gridview链接按钮上弹出

时间:2011-04-25 12:33:27

标签: c# asp.net

这是aspx页面代码

                                                                                    'OnClick =“lnkCustomer”>                                                                                                                                                                                                                                   “         SelectCommand =“SELECT DISTINCT [firstname],[middlename],[lastname],[mobile],[city],[title],[enquirymasterid] FROM [EnquiryMaster]”>          

* 我在gridview中的链接按钮后面编写了这段代码,但弹出窗口没有显示 * w

protected void lnkCustomer(object sender, EventArgs e)
   {
       //Retrieve Customer ID
       LinkButton lnkCustomerID = sender as LinkButton;
       string strCustomerID = lnkCustomerID.Text;

       //Create sql connection and fetch data from database based on CustomerID
       string strConnectionString = ConfigurationManager.ConnectionStrings["connstring"].ConnectionString;
       string strSelect = "SELECT DISTINCT [firstname], [middlename], [lastname], [mobile], [city], [title], [enquirymasterid] FROM [EnquiryMaster] WHERE enquirymasterid = @enquirymasterid";
       SqlConnection sqlCon = new SqlConnection();
       sqlCon.ConnectionString = strConnectionString;
       SqlCommand cmdCustomerDetails = new SqlCommand();        
            cmdCustomerDetails.Connection = sqlCon;
        cmdCustomerDetails.CommandType = System.Data.CommandType.Text;
        cmdCustomerDetails.CommandText = strSelect;
        cmdCustomerDetails.Parameters.AddWithValue("@enquirymasterid", strCustomerID);
       sqlCon.Open();

       //Create DataReader to read the record
        SqlDataReader dReader = cmdCustomerDetails.ExecuteReader();
       GridView2.DataSource = dReader;
        GridView2.DataBind();
        sqlCon.Close();
        modalPopUpExtender1.Show();
}

1 个答案:

答案 0 :(得分:0)

“通话”按钮应位于更新面板内,请阅读this blogpost (你可能想考虑根本不使用ajaxcontroltoolkit并切换到基于jquery的解决方案)