private void Save() { Page.Validate(); if (Page.IsValid) { FlatSectionJls flatSectionJls = new FlatSectionJls(flatSectionJlsTDS); // Update flatSectionJlsTDS foreach (GridViewRow row in grdvJls.Rows) { // ... Get standard fields int workId = int.Parse(((HiddenField)row.FindControl("hdfWorkID")).Value); string street = ""; if (((TextBox)row.FindControl("tbxStreet")).Text.Trim() != "") street = ((TextBox)row.FindControl("tbxStreet")).Text.Trim(); string usmhId = ""; if (((TextBox)row.FindControl("tbxUSMH")).Text.Trim() != "") usmhId = ((TextBox)row.FindControl("tbxUSMH")).Text.Trim(); string dsmhId = ""; if (((TextBox)row.FindControl("tbxDSMH")).Text.Trim() != "") dsmhId = ((TextBox)row.FindControl("tbxDSMH")).Text.Trim(); string size_ = ""; if (((TextBox)row.FindControl("tbxSize_")).Text.Trim() != "") size_ = ((TextBox)row.FindControl("tbxSize_")).Text.Trim(); string length = ""; if (((TextBox)row.FindControl("tbxLength")).Text.Trim() != "") length = ((TextBox)row.FindControl("tbxLength")).Text.Trim(); string subArea = ""; if (((TextBox)row.FindControl("tbxSubArea")).Text.Trim() != "") subArea = ((TextBox)row.FindControl("tbxSubArea")).Text.Trim(); string trafficControl = ""; if (((DropDownList)row.FindControl("ddlTrafficControl")).SelectedValue != " ") trafficControl = ((DropDownList)row.FindControl("ddlTrafficControl")).SelectedValue; string trafficControlDetails = ""; if (((TextBox)row.FindControl("tbxTrafficControlDetails")).Text.Trim() != "") trafficControlDetails = ((TextBox)row.FindControl("tbxTrafficControlDetails")).Text.Trim(); bool standardBypass = ((CheckBox)row.FindControl("cbxStandardBypass")).Checked; string standardBypassComments = ""; if (((TextBox)row.FindControl("tbxStandardBypassComments")).Text.Trim() != "") standardBypassComments = ((TextBox)row.FindControl("tbxStandardBypassComments")).Text.Trim(); // ... Update row flatSectionJls.Update(workId, street, usmhId, dsmhId, size_, length, subArea, trafficControl, trafficControlDetails, standardBypass, standardBypassComments); } // Store datasets Session["flatSectionJlsTDS"] = flatSectionJlsTDS; // Update database UpdateDatabase(); ViewState["update"] = "yes"; // Redirect string url = ""; if (Request.QueryString["source_page"] == "jls_navigator2.aspx") { url = "./jls_navigator2.aspx?source_page=flat_section_jls_edit.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + GetNavigatorState() + "&update=yes"; } if (Request.QueryString["source_page"] == "flat_section_jls_summary.aspx") { url = "./flat_section_jls_summary.aspx?source_page=flat_section_jls_edit.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + GetNavigatorState() + "&update=yes"; } Response.Redirect(url); } }
private void Apply() { Page.Validate(); if (Page.IsValid) { FlatSectionJls flatSectionJls = new FlatSectionJls(flatSectionJlsTDS); // Update flatSectionJlsTDS foreach (GridViewRow row in grdvJls.Rows) { // ... Get standard fields int workId = int.Parse(((HiddenField)row.FindControl("hdfWorkID")).Value); string street = ""; if (((TextBox)row.FindControl("tbxStreet")).Text.Trim() != "") street = ((TextBox)row.FindControl("tbxStreet")).Text.Trim(); string usmhId = ""; if (((TextBox)row.FindControl("tbxUSMH")).Text.Trim() != "") usmhId = ((TextBox)row.FindControl("tbxUSMH")).Text.Trim(); string dsmhId = ""; if (((TextBox)row.FindControl("tbxDSMH")).Text.Trim() != "") dsmhId = ((TextBox)row.FindControl("tbxDSMH")).Text.Trim(); string size_ = ""; if (((TextBox)row.FindControl("tbxSize_")).Text.Trim() != "") size_ = ((TextBox)row.FindControl("tbxSize_")).Text.Trim(); string length = ""; if (((TextBox)row.FindControl("tbxLength")).Text.Trim() != "") length = ((TextBox)row.FindControl("tbxLength")).Text.Trim(); string subArea = ""; if (((TextBox)row.FindControl("tbxSubArea")).Text.Trim() != "") subArea = ((TextBox)row.FindControl("tbxSubArea")).Text.Trim(); string trafficControl = ""; if (((DropDownList)row.FindControl("ddlTrafficControl")).SelectedValue != " ") trafficControl = ((DropDownList)row.FindControl("ddlTrafficControl")).SelectedValue; string trafficControlDetails = ""; if (((TextBox)row.FindControl("tbxTrafficControlDetails")).Text.Trim() != "") trafficControlDetails = ((TextBox)row.FindControl("tbxTrafficControlDetails")).Text.Trim(); bool standardBypass = ((CheckBox)row.FindControl("cbxStandardBypass")).Checked; string standardBypassComments = ""; if (((TextBox)row.FindControl("tbxStandardBypassComments")).Text.Trim() != "") standardBypassComments = ((TextBox)row.FindControl("tbxStandardBypassComments")).Text.Trim(); // ... Update row flatSectionJls.Update(workId, street, usmhId, dsmhId, size_, length, subArea, trafficControl, trafficControlDetails, standardBypass, standardBypassComments); } // Store datasets Session["flatSectionJlsTDS"] = flatSectionJlsTDS; // Update database UpdateDatabase(); ViewState["update"] = "yes"; } }