protected void InvoicesGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex != -1) { DBConnection obj = new DBConnection(); try { HyperLink lnkProperty = (HyperLink)e.Row.FindControl("hlkProperty"); if (lnkProperty != null) { string vNum = lnkProperty.Text; //get city, state, country using property number DataTable dt = VADBCommander.CityStatePropertyInd(vNum); if (dt.Rows.Count > 0) { string vCity = dt.Rows[0]["city"].ToString(); vNum = dt.Rows[0]["state"].ToString(); dt = VADBCommander.StateProvinceNamedInd(vNum); string vState = dt.Rows[0]["state"].ToString(); vNum = dt.Rows[0]["country"].ToString(); dt = VADBCommander.CountryInd(vNum); string vCountry = dt.Rows[0]["country"].ToString(); lnkProperty.NavigateUrl = CommonFunctions.PrepareURL(vCountry + "/" + vState + "/" + vCity + "/" + lnkProperty.Text + "/default.aspx"); } } } catch (Exception ex) { Response.Write("Error with response"); } finally { obj.CloseConnection(); } } }
//protected System.Data.SqlClient.SqlConnection Connection; protected void Page_Load(object sender, System.EventArgs e) { System.Data.SqlClient.SqlCommandBuilder builder = new System.Data.SqlClient.SqlCommandBuilder(EmailsAdapter); //if (propertyid == -1) // Response.Redirect (CommonFunctions.PrepareURL ("default.aspx"), true); //string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; //CommonFunctions.Connection.ConnectionString = connectionstring; PropertiesAdapter.SelectCommand.Parameters["@PropertyID"].Value = propertyid; PhotosAdapter.SelectCommand.Parameters["@PropertyID"].Value = propertyid; //lock (CommonFunctions.Connection) if (PropertiesAdapter.Fill(PropertiesFullSet) < 1) { Response.Redirect(backlinkurl); } //lock (CommonFunctions.Connection) PhotosAdapter.Fill(PhotosSet); if (!(bool)PropertiesFullSet.Tables["Properties"].Rows[0]["IfApproved"] && (!AuthenticationManager.IfAuthenticated || ((AuthenticationManager.UserID != (int)PropertiesFullSet.Tables["Properties"].Rows[0]["UserID"]) && !AuthenticationManager.IfAdmin))) { Response.Redirect(backlinkurl, true); } BackLink.NavigateUrl = CommonFunctions.PrepareURL("ViewProperty.aspx?PropertyID=" + propertyid.ToString(), backlinktext); if (!IsPostBack) { DataBind(); } //new link menu DBConnection obj = new DBConnection(); try { string vNum = propertyid.ToString(); //get city, state, country using property number DataTable dt = VADBCommander.CityStatePropertyInd(vNum); if (dt.Rows.Count > 0) { string vCity = dt.Rows[0]["city"].ToString(); vNum = dt.Rows[0]["state"].ToString(); dt = VADBCommander.StateProvinceNamedInd(vNum); string vState = dt.Rows[0]["state"].ToString(); vNum = dt.Rows[0]["country"].ToString(); dt = VADBCommander.CountryInd(vNum); string vCountry = dt.Rows[0]["country"].ToString(); //lnkCountry.Text = vCountry; //lnkCountry.NavigateUrl = CommonFunctions.PrepareURL(vCountry + "/default.aspx"); //lnkState.Text = vState; //lnkState.NavigateUrl = CommonFunctions.PrepareURL(vCountry + "/" + vState + "/default.aspx"); //lnkCity.Text = vCity; //lnkCity.NavigateUrl = CommonFunctions.PrepareURL(vCountry + "/" + vState + "/" + vCity + "/default.aspx"); lnkProperty.Text = "Property #" + propertyid.ToString(); lnkProperty.NavigateUrl = CommonFunctions.PrepareURL(vCountry + "/" + vState + "/" + vCity + "/" + propertyid + "/default.aspx"); Session["emailReturnURL"] = CommonFunctions.PrepareURL(vCountry + "/" + vState + "/" + vCity + "/default.aspx"); } } catch (Exception ex) { Response.Write("Error with response"); } finally { obj.CloseConnection(); } }