将图像按钮显示为 HTML
是否可以将 asp:ImageButton 显示为 HTML?
下面是一段代码;
e.Row.Cells[0].Text = "<img src='Images/desc.gif' >";
由于其 postbackURL 属性(因为它支持导航),我需要将其替换为 asp:imagebutton
因此,我已将代码替换为 ;
e.Row.Cells[0].Text = "<asp:ImageButton id=imgtempasc runat=server ImageUrl=~/Images/tempasc.gif PostBackUrl=~/OT_Overview_Home.aspx >";
显示图像按钮而不是图像(如代码#1),但代码#2不起作用,
谢谢!
Is it possible to show asp:ImageButton as HTML?
Below is piece of code;
e.Row.Cells[0].Text = "<img src='Images/desc.gif' >";
which i need to replace with asp:imagebutton due to its postbackURL property (as it supports navigation)
Hence i have replaced my code as ;
e.Row.Cells[0].Text = "<asp:ImageButton id=imgtempasc runat=server ImageUrl=~/Images/tempasc.gif PostBackUrl=~/OT_Overview_Home.aspx >";
to show image button instead of image (as in code # 1) but Code # 2 doesn't work
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我真的不明白为什么如果你修改代码中的单元格就不能使用
HyperLink
?特别是如果您所做的只是将用户发送到另一个 URL。如果您只是将用户从一个 URL 发送到另一个 URL,那么这不起作用
如果您需要将表单数据从现有页面发布到另一页面,那么您将需要执行 Andreas Niederair 建议的操作并动态添加控件到网格视图
I really don't understand why you cannot use a
HyperLink
if you are modifying the Cell in your code? Especially if all you are doing is sending the user to another URL.If you are simply sending the user from one URL to another, then will this not work
If you require form data to be posted from your existing page to another page, then you will need to do what Andreas Niedermair has suggested and dynamically add the control to the GridView
您可以使用 ASP:超链接!
超链接控件有一个 ImageUrl 属性,您可以使用该属性来设置链接的图像。
您可以使用超链接做任何您想做的事情。
You can use ASP:HyperLink!
Hyperlink Control has a ImageUrl property that you can use in order to set image for your link.
You can do whatever you want with hyperlink.
我猜你想修改你的控制集合。因此,您需要正确执行此操作,如下所示:
i guess you want to modify your control-collection. therefore you will need to do it right, like this: