“ SelectCommand="SELECT DISTINCT [firstname], [middlename], [las-6ren">
gpt4 book ai didi

c# - 在 gridview 链接按钮上弹出

转载 作者:太空宇宙 更新时间:2023-11-03 16:46:27 26 4
gpt4 key购买 nike

这是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();
}

最佳答案

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

关于c# - 在 gridview 链接按钮上弹出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5778351/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com