popup on gridview link button
this is aspx page code
' OnClick="lnkCustomer"> " SelectCommand="SELECT DISTINCT [firstname], [middlename], [lastname], [mobile], [city], [title], [enquirymasterid] FROM [EnquiryMaster]">*I have written this code behind link button in gridview but the popup doesnt sho*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();
}
The 'calling' button should be inside a updatepanel, read this blogpost (You might wanna consider not using the ajaxcontroltoolkit at all and switch to a jquery based solution)
精彩评论