通过C#定义标签Asp.net坐标 [英] Define a Label Asp.net Coordinates through C#

查看:77
本文介绍了通过C#定义标签Asp.net坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个动态的System.Web.UI.WebControls.Label并在Asp.net页面中定义其坐标.

I need to create dinamically a System.Web.UI.WebControls.Label and define its cordinates in the Asp.net Page.

我知道它的绝对位置(x,y).但是我不知道定义它的任何方法. 这是我创建标签的方法:

I know it absolute position (x,y). But i dont know any way to define it. Here is how i create the label:

        System.Web.UI.WebControls.Label box3 = new System.Web.UI.WebControls.Label();
        box3.Text = entradas.ElementAt(0).text;
        box3.ID = "box3";
        //need to define x and y here

问题是如何定义其位置. 预先感谢

The question is how to define its position. Thanks in advance

推荐答案

Label控件具有

The Label control has an Attributes property which you can use to define the labels position on the front end.

例如:-

label.Attributes.Add("style", "top:10; right:10; position:absolute;");

或者,您可以将一些CSS应用于呈现的HTML ...

Alternatively, you could just apply some CSS to the rendered HTML...

这篇关于通过C#定义标签Asp.net坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆