English 中文(简体)
如何插入图像,以连接布顿?
原标题:how to insert imagebutton to linkbutton is it a bug?

i 设法添加图纽顿语,把纽特语连接起来,但如何使以下代码不发挥作用?


  ImageButton _btnSave = new ImageButton();
            _btnSave.ID = Guid.NewGuid().ToString();
            _btnSave.AlternateText = "fsfsf";
            _btnSave.Click += new ImageClickEventHandler(btnSave_Click);
            _btnSave.Attributes.Add("runat", "server");
            _btnSave.ImageUrl = "~/images/Ok.png";

            LinkButton btnSave = new LinkButton();
            btnSave.ID = Guid.NewGuid().ToString();

            PlhControl.Controls.Add(_btnSave);
            btnSave.Text = "Test";
            btnSave.Attributes.Add("runat", "server");
            btnSave.Click += new EventHandler(btnSave_Click);
            PlhControl.Controls.Add(btnSave);

最佳回答

你应该把图像Button插入“LinkButton”,你应该只增加形象而不是形象。

问题回答

绝对不需要将<代码>LinkButton插入。 这两种控制基本上都是一样的;它们只是看着不同的。

你们可以做的是,在“联系邦”内树立了形象,除了几个关键差异(提交行为)外,这一形象将基本上成为“条码”。

LinkButton btnSave = new LinkButton(); 
btnSave.ID = Guid.NewGuid().ToString();  
btnSave.Attributes.Add("runat", "server"); 
btnSave.Click += new EventHandler(btnSave_Click); 

Image img = new Image();
img.ImageUrl = "someimage.png";
btnSave.Controls.Add(img);

PlhControl.Controls.Add(btnSave); 




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签