Inheriting controls from a web page(asp 1.0)
-
hI, I have a web page in which i am generating all the controls dynamically .I have a place holder(also dynamically generated)in webform1 into which i am pushing all the All the generated controls . Now i want ato inherit this page into webform2 .What i tried was public class Webform2 : webform1 in webform class i have a ftion public void look() { // Response.Write("look"); PlaceHolder pl = new PlaceHolder(); TextBox tb; tb = new TextBox(); tb.Text = "adarsh"; tb.Visible = true; tb.Width = Unit.Percentage(20); tb.Height = Unit.Percentage(20); pl.Controls.Add(tb); this.form1.Controls.Add(pl); } } in webform2 class i call page load event i call this ftion look .But it gives a runtime exception saying in line this.form1.Controls.Add(pl); object reference not set to an instance of an object.Why is this and pls suggest any solution for this. -- modified at 1:54 Monday 3rd July, 2006