如何动态地创建在asp.net C#的运行时间标签,网页上的特定地点 [英] How to dynamically create label on run time in asp.net c# to a particular place on web page
本文介绍了如何动态地创建在asp.net C#的运行时间标签,网页上的特定地点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建一个网页,并在我想要显示的标签上的数据。这些数据将通过SQL连接显示。我知道如何创建标签,但我不知道如何将它们创造网页的特定位置。
谢谢,
周杰伦
解决方案
< DIV ID =DIV1RUNAT =断绝>< / DIV>//创建一个Label对象
标签dynamicLabel =新的Label();
div1.Controls.Add(dynamicLabel);
在此code添加一个CSS类。
< DIV ID =DIV1级=位置RUNAT =断绝>< / DIV>
和在Styles.css中添加此code ...
.location
{
利润率左:30PX
的margin-top:30PX
}
您也可以使用其他属性...
I am creating a web page and in that I want to show data on label. The data will be shown through a SQL connection. I know how to create labels but I don't know how to create them to a particular place of web page.
Thanks,
Jay
解决方案
<div id="div1" runat = "sever" ></div>
// Create a Label object
Label dynamicLabel = new Label();
div1.Controls.Add(dynamicLabel );
In this code add one css class..
<div id="div1" class="location" runat = "sever" ></div>
and in your styles.css add this code...
.location
{
margin-left: 30px
margin-top: 30px
}
you can also use other attributes...
这篇关于如何动态地创建在asp.net C#的运行时间标签,网页上的特定地点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文