Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to create dynamic label according to database table's value.It will check till last cell of column and create lable for each cell's value in next line?
Posted

Hi,

use this code
Label label = new Label();
label.Text = "The Text";
PlaceHolder1.Controls.Add(label);
 
Share this answer
 
Comments
Janardan Pandey 2-Nov-11 5:02am    
I want to create lable according to column's value of a table?
sabbi26 2-Nov-11 5:20am    
i am not getting what's ur requirement.
u can simply assign the table column's value to the label by using above code.
"label.Text = "yourtablevalueobject.tostring()""
You can create a label like any other control dynamically
C#
System.Windows.Forms.Label newLabel = new System.Windows.Forms.Label()
Then set its Location, Size and Text properties and finally add it to its parent's Controls collection.

But you could as well use some sort of grid to display tabular data.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900