用户控件,用户控件布局问题

用户控件布局问题 - 故障解答 - 电脑教程网

用户控件布局问题

日期:2007-03-10   荐:
用户控件布局问题//UserControl GoodBookCtrl=(UserControl)LoadControl("ascx/top.ascx");//Panel1.Controls.Add(GoodBookCtrl);//Panel1.Style["position"]="absolute";//Panel1.Style["left"]="50";//Panel1.Style["top"]="0";UserControl GoodBookCtrl=(UserControl)LoadControl("ascx/top.ascx");Panel1.Controls.Add(GoodBookCtrl);//Panel1=(Panel)GoodBookCtrl.FindControl("Panel1");Panel1.Style["position"]="absolute";Panel1.Style["top"]="0"; Panel1.Style["left"]="0";从程序中载了部分,怎么都不行,怎么才能使控件放到我想要的地方我这里是个放在顶部的菜党,搜索之类的,急用!!!!!!!!!怎么没人回答问题,我再加点分,大家帮帮忙一般位置是由开发人员决定的,不是控件决定的Panel loPanel = new Panel();loPanel.BackColor = Color.Red;loPanel.Width=20;loPanel.Height=10;loPanel.Attributes.Add("style","position:absolute;left:" 10 ";top:" 10);//this.Controls.Add(loPanel); Page.Controls.Add(loPanel);up在前台实现!用javascriptfunction init(){//具体的布局代码。}后台的web控件在前台生成一个html标签,,比如<asp:Label id="Label1"/>控件在前台就是<span id="Label1"></span>使用其id号即可实现任何布局。比如:id1.style.position="absolute";id1.style.left=10;////实现用相对定位:
标签: