Note that there are some explanatory texts on larger screens.

plurals
  1. POsearch button load gridview after c# asp.net 2.0
    primarykey
    data
    text
    <p>When i click the search button,load the Gridview.At that GridView,i can add,delete and update. When the user click add , the message box pop up "Customer added successfuly" Then i have to click " SearchButton" again.If not i cant see the GridView again. Cause i just wirte the code to load the Gridview by clicking the Searchbutton. How can I fix it? For the Very first time, I just have some dropdownlist and Search button only. Please help me. Thanks </p> <pre><code> protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { //Check if Add button clicked if (e.CommandName == "AddProject") { try { //Get the values stored in the text boxes string strProjectName = ((TextBox)GridView1.FooterRow.FindControl("txtPJDESCLONG")).Text; string strLastUpdate = ((TextBox)GridView1.FooterRow.FindControl("txtLASTUPDATE")).Text; string strStatus = ((TextBox)GridView1.FooterRow.FindControl("txtSTATUS")).Text; string strUsername = ((TextBox)GridView1.FooterRow.FindControl("txtUSERNAME")).Text; string strProjCode = ((TextBox)GridView1.FooterRow.FindControl("txtPJCODE")).Text; //Prepare the Insert Command of the DataSource control DataSet ds = new DataSet(); SqlConnection conn = new SqlConnection(strConn); string strSQL = ""; if (conn.State == ConnectionState.Closed) { conn.Open(); } strSQL = "INSERT INTO CTORGPROJ (CTPAPBRCH,CTPAPDIV,CTPAPDEPT,CTPAPSECT,CTPAPSSEC,CTPAPPDIV,CTPAPLOC,CTPAPPDEP,PJCODE,PJDESCLONG,LASTUPDATE,STATUS, " + "USERNAME) VALUES ('" + cboBranch.SelectedValue + "','" + cboDivision.SelectedValue + "','" + cboDepartment.SelectedValue + "','" + cboSection.SelectedValue + "','" + cboSubSection.SelectedValue + "','" + cboLocation.SelectedValue + "','" + cboPayDivision.SelectedValue + "','" + cboPayDepartment.SelectedValue + "','" + strProjCode + "','" + strProjectName + "','" + strLastUpdate + "','" + strStatus + "','" + strUsername + "')"; Session.Add("conn", CookieUtil.GetTripleDESEncryptedCookieValue("sConn").Replace("-", ";")); Session.Add("PjNo", CookieUtil.GetTripleDESEncryptedCookieValue("sPjCode")); Session.Add("sComCode", CookieUtil.GetTripleDESEncryptedCookieValue("sComCode")); string _strConn = Session["conn"].ToString(); _strConn = _strConn.Replace("Provider=SQLOLEDB;", ""); SqlDataSource SqlDataSource1 = new SqlDataSource(_strConn, strSQL); SqlDataSource1.InsertCommand = strSQL; SqlDataSource1.Insert(); ClientScript.RegisterStartupScript(GetType(), "Message", "&lt;SCRIPT LANGUAGE='javascript'&gt;alert('Customer added successfully');&lt;/script&gt;"); GridView1.DataBind(); conn.Close(); conn.Dispose(); } catch (Exception ex) { ClientScript.RegisterStartupScript(GetType(), "Message", "&lt;SCRIPT LANGUAGE='javascript'&gt;alert('" + ex.Message.ToString().Replace("'", "") + "');&lt;/script&gt;"); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload