在运行时动态绘制div [英] draw div dynamically at runtime

查看:85
本文介绍了在运行时动态绘制div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,
我有一个页面,可以在运行时动态绘制其所有属性.
并且我想在每个div中绘制属性名称,在其旁边绘制adiv以在其中放置一个文本框.
我已经创建了div,但是我无法处理它的位置....

hiii all,
i have a page which i draw all its attributes in the runtime dynamically.
and i want in every div i draw in attribute name, draw beside it adiv to put a textbox in it.
i have created the div , but i can''t handle its position ....

HtmlGenericControl NewControl = new HtmlGenericControl("div");
NewControl.ID = "NewControl";
NewControl.InnerHtml = "This is a dynamically created HTML control.";
test2.Controls.Add(NewControl);


所以,请帮忙...

谢谢


So , any help , please......

Thanks

推荐答案



作为代码,您必须按顺序将控件添加到一个动态表单元格中

如表单元格00中的名称和表单元格01中的文本框



As your code you''ve to add your controls to one dynamic table cells in orderlly

like name in table cell 00 and textbox in table cell 01

Divid.innerHtml="<table width="60%" align="center"><tr><td><div id="fgf">this dynamically created html control </div></td><input type="text" id="fdg" /></tr></table>";



只有这样,您才能在网页中获得正确的位置

你也可以用另一种方式做
通过设置样式属性,例如position:fixed; left:12px; top:30px;

我希望你能理解我说的话

最好的



By this only you can get correct position in webpage

you can do it in another way also
by setting style property like position:fixied;left:12px;top:30px;

I hope you understood what I said

All the Best


这篇关于在运行时动态绘制div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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