Update Query not updating on Button Click in Modal Popup.
Any Field i update will go blank.
Please help.
My code
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
<link href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function () {
$(".grid").DataTable({
bLengthChange: true,
lengthMenu: [[10, 30, -1], [10, 30, "All"]],
bFilter: true,
bSort: true,
bPaginate: true
});
});
function ShowPopup() {
$("#dialog").dialog({
title: "VIEW DIE DETAILS",
width: 830,
height: 500,
buttons: {
Close: function () {
$(this).dialog('close');
}
},
modal: true
});
};
function ShowPopup1() {
$("#dialog1").dialog({
title: "EDIT DIE DETAILS",
width: 830,
height: 500,
buttons: {
Close: function () {
$(this).dialog('close');
}
},
modal: true
});
};
</script>
<script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
$(".grid").DataTable({
bLengthChange: true,
lengthMenu: [[10, 30, -1], [10, 30, "All"]],
bFilter: true,
bSort: true,
bPaginate: true
});
}
});
};
</script>
public partial class Die : System.Web.UI.Page
{
protected void ImageButton1_Click(object sender, object e)
{
updateSQL = "UPDATE job_die set ";
updateSQL += "dieno=@dieno,templateno=@templateno,model=@model,type=@type,brassfemaleembossin=@brassfemaleembossin,";
updateSQL += "brassmaleembossing=@brassmaleembossing,supplier=@supplier,lcutterwidth=@lcutterwidth,lcutterlength=@lcutterlength,comment=@comment,";
updateSQL += "lmacross=@lmacross,lmaround=@lmaround,caditemidno=@caditemidno,cadrefno=@cadrefno ,cadnoups=@cadnoups,cadpackheight=@cadpackheight,";
updateSQL += "cadpackwidth=@cadpackwidth,cadpackbreadth=@cadpackbreadth,caddesignheight=@caddesignheight,caddesignwidth=@caddesignwidth,cadgripperwidth=@cadgripperwidth ,";
updateSQL += "cadgripperlenth=@cadgripperlenth,cadchargenno=@cadchargenno WHERE id=@id ";
// updateSQL += "";
dbConn2.ConnectionString = "Data source=Graden\\EXPRESS01; Initial Catalog=Household;Integrated Security=True;";
cmd1.Connection = dbConn2;
cmd1.CommandText = updateSQL;
cmd1.CommandType = CommandType.Text;
cmd1.Parameters.AddWithValue("@dieno", TextBox1.Text);
cmd1.Parameters.AddWithValue("@templateno", TextBox2.Text);
cmd1.Parameters.AddWithValue("@model", TextBox3.Text);
cmd1.Parameters.AddWithValue("@type", TextBox4.Text);
cmd1.Parameters.AddWithValue("@brassfemaleembossin", TextBox5.Text);
cmd1.Parameters.AddWithValue("@brassmaleembossing", TextBox6.Text);
cmd1.Parameters.AddWithValue("@supplier", TextBox7.Text);
cmd1.Parameters.AddWithValue("@lcutterwidth", TextBox8.Text);
cmd1.Parameters.AddWithValue("@lcutterlength", TextBox9.Text);
cmd1.Parameters.AddWithValue("@comment", TextBox10.Text);
cmd1.Parameters.AddWithValue("@lmacross", TextBox11.Text);
cmd1.Parameters.AddWithValue("@lmaround", TextBox12.Text);
cmd1.Parameters.AddWithValue("@caditemidno", TextBox13.Text);
cmd1.Parameters.AddWithValue("@id", Session["sid"].ToString());
cmd1.Parameters.AddWithValue("@cadrefno", TextBox14.Text);
cmd1.Parameters.AddWithValue("@cadnoups", TextBox15.Text);
cmd1.Parameters.AddWithValue("@cadpackheight", TextBox16.Text);
cmd1.Parameters.AddWithValue("@cadpackwidth", TextBox17.Text);
cmd1.Parameters.AddWithValue("@cadpackbreadth", TextBox18.Text);
cmd1.Parameters.AddWithValue("@caddesignheight", TextBox19.Text);
cmd1.Parameters.AddWithValue("@caddesignwidth", TextBox20.Text);
cmd1.Parameters.AddWithValue("@cadgripperwidth", TextBox21.Text);
cmd1.Parameters.AddWithValue("@cadgripperlenth", TextBox22.Text);
cmd1.Parameters.AddWithValue("@cadchargenno", TextBox23.Text);
try
{
dbConn2.Open();
Response.Write(updateSQL);
int updated = cmd1.ExecuteNonQuery();
// Response.Write(updateSQL);
Label71.Visible = true;
Label71.Text = updated.ToString() + " records updated.";
// Response.Redirect("~/Thanku.aspx");
}
//catch (Exception err)
//{
// Label1K.Text = "Error updating record";
// Label1K.Text += err.Message;
//}
finally
{
dbConn2.Close();
}
}
}