Dynamic generation of controls
I have to generate a page with dynamic controls with data coming from database.Depending upon control type coming from database i have to create a control in the web page and assign value to it which comes from database. web control values also comes from database.Could any body can help me in this.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Mahesh Joshi70 pointsPosted Nov 22, 2007, 7:30 PM EST
See the below code to create controls dynamically -
Suppose you need to create TextBox
TextBox t = new TextBox();
Get the value from the database and assign it
t.Text = "abcd";
some other examples -
DataGrid dg = new DataGrid();
DataGridView dgv = new DataGridView();