protected void btnSave_OnClick(object sender, EventArgs e) { bool ngo = false, notpartisan = false, nonprofit = false, legally = false; DateTime yearOfAdmn; string usanm = Session["username"].ToString(); string contactP = TextBxcont.Text.Trim(); string currposition = TextBoposition.Text.Trim(); string postaddress = TextBxpostal.Text.Trim(); string postcode = ""; string tao = txtPostalTown.Text.Trim(); string phoneNum = TextBoxphone.Text.Trim(); string webs = TextBoxweb.Text.Trim(); string registrationNum = TextBoxreg.Text.Trim(); string physicAddre = txtPhysicallAddr.Text.Trim(); string nonPartisanTxtA = txtAreaPartisan.Text.Trim(); //string nonPtrimmed = txtAreaPartisan.Text.Substring(0, txtAreaPartisan.Text.Length - 1); string regType = ddlRegtype.SelectedItem.Text; int nonG = ddlOrgType.SelectedIndex; if (nonG == 0) { KCDFAlert.ShowAlert("Select valid option!"); } if (nonG == 1) { ngo = false; } if (nonG == 2) { ngo = true; } int nonPart = ddlnonPartisan.SelectedIndex; if (nonPart == 0) { KCDFAlert.ShowAlert("Select valid option!"); } if (nonPart == 1) { notpartisan = false; } if (nonPart == 2) { notpartisan = true; } if (nonPart == 1 && nonPartisanTxtA == "") { KCDFAlert.ShowAlert("Please describe your partisanship"); return; } int nonProfit = ddlNonProfitable.SelectedIndex; if (nonProfit == 0) { KCDFAlert.ShowAlert("Select valid option!"); } if (nonProfit == 1) { nonprofit = false; } if (nonProfit == 2) { nonprofit = true; } int legal = ddlLegal.SelectedIndex; if (legal == 0) { KCDFAlert.ShowAlert("Select valid option!"); } if (legal == 1) { legally = false; } if (legal == 2) { legally = true; } if (ddlPostalCode.SelectedIndex == 0) { KCDFAlert.ShowAlert("Please select postal code"); return; } else { postcode = ddlPostalCode.SelectedItem.Text; } var YoReg = dateofReg.Value.Trim(); if (string.IsNullOrWhiteSpace(YoReg)) { KCDFAlert.ShowAlert("Select a Valid Date"); dateofReg.Focus(); return; } else { yearOfAdmn = DateTime.Parse(YoReg); } try { var credentials = new NetworkCredential(ConfigurationManager.AppSettings["W_USER"], ConfigurationManager.AppSettings["W_PWD"], ConfigurationManager.AppSettings["DOMAIN"]); Portals sup = new Portals(); sup.Credentials = credentials; sup.PreAuthenticate = true; if (sup.FnRegGranteeInfo(usanm, contactP, currposition, phoneNum, postaddress, postcode, tao, ngo, notpartisan, nonprofit, legally, physicAddre, regType, yearOfAdmn, webs, registrationNum, nonPartisanTxtA)) { // KCDFAlert.ShowAlert("Organization Information updated successfully!"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "thisBitchcode", "alert('Organization Information updated successfully!');", true); loadApplicationInfo(); } } catch (Exception exO) { KCDFAlert.ShowAlert("Error Occured, contact System Administrator!"); } }