使用C#动态创建控件 [英] Dynamically Creating Control using C#

查看:63
本文介绍了使用C#动态创建控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Guys ...



这里我动态创建两个html控件...一个是标签控件,第二个是链接......但是问题是什么我面临的是两个控件都是单线...





喜欢......



AshuRawat 点击下载



这里ashirawat是标签控制中的文字,点击下载是链接....



我想点击下载进入下一行...

喜欢... 不使用BREAK CONTROL ...或者我想要使用任何虚拟控制



AshuRawat

点击进入下载



请帮助我们解决这个问题....



Thanx提前...



创建控制的代码就是这个.... ::::





System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label();

lbl.Text = obizLayer.Subscripti onMessage;

divMain.Controls.Add(lbl);

HtmlAnchor albl = new HtmlAnchor();

albl.InnerHtml = obizLayer.SubscriptionLinkText ;

albl.HRef = obizLayer.SubscriptionLinkURL;

divMain.Controls.Add(albl);

解决方案

为什么不手动添加换行符(使用BR标记)或在段落中插入控件(P标记)?


或/并使用css

Hello Guys...

Here I am Creating two html controls dynamically...one is label control and second one is link...but what issue i am facing is that both the controls are coming in single line...


like...

AshuRawatClick to download

here ashirawat is text in label control and click to download is link....

I want Click to download to be in next line...
like...WITHOUT USING BREAK CONTROL...OR I DO"T WANT TO USE ANY DUMMY CONTROL

AshuRawat
Click to download

Please Help me guys to resolve this issue....

Thanx in Advance...

MY CODE FOR CREATING CONTROL IS THIS....::::


System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label();
lbl.Text = obizLayer.SubscriptionMessage;
divMain.Controls.Add(lbl);
HtmlAnchor albl = new HtmlAnchor();
albl.InnerHtml = obizLayer.SubscriptionLinkText;
albl.HRef = obizLayer.SubscriptionLinkURL;
divMain.Controls.Add(albl);

解决方案

Why don''t you manually add a line break (with the BR tag) or insert the controls in a paragraph (the P tag)?


Or/And use css


这篇关于使用C#动态创建控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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