here is the code I create textbox from C# code..
for (int x = 0; x < 30; x++)
{
TextBox txt = new TextBox();
txt.ID = "txt - " + x.ToString();
data.Controls.Add(txt);
data.Controls.Add(new LiteralControl("<br/>"));
}
all textbox will be stick to each other.. I wonder can I add padding-top in the loop? how may I do it?
thanks for your help and your suggestion and comment is appreaciated.
This is create by using C#
I wish want got space like this.
please ignore the drop down box.. its just example.
I hope you know something about
CSS
andstylesheets
? You can render anything you want in the backend like in your example: textboxes. Using CSS you can add some style to it. This doesn't needs to be done during the creation of your controls.In your example just create a stylesheet like
default.css
and add it into your page using:Then using following code you can add some padding or even better some margin to your inputs:
Another solution is using classes:
ASP.NET
CSS