object is not set to an instance of an object
public static void fill(string property) { Page page = (Page)HttpContext.Current.Handler; TextBox TenancyAddress = (TextBox)page.FindControl("TenancyAddress"); TenancyAddress.Text = property; } [WebMethod] public static void LookupUpdate(string id) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ToString()); con.Open(); SqlCommand cmd = new SqlCommand("select * from [godaddy].[dbo].[Property] where [Prop_id] = " + id, con); SqlDataAdapter sda = new SqlDataAdapter(); cmd.Connection = con; sda.SelectCommand = cmd; DataSet ds = new DataSet(); sda.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { Page page = (Page)HttpContext.Current.Handler; TextBox TenancyAddress = (TextBox)page.FindControl("TenancyAddress"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string property = ds.Tables[0].Rows[i]["PropertyName"].ToString(); fill(property); } } con.Close(); }
TextBox TenancyAddress = (TextBox)page.FindControl("TenancyAddress");
TenancyAddress
public static void LookupUpdate(string id, TextBox tb)
tb.Text=property
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)