将标签转为链接按钮 [英] Turn label to link button

查看:65
本文介绍了将标签转为链接按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有asp.net标签,他的文本是从SQL绑定的。

如果文本包含'x' - 我需要将此标签设为linkBut​​ton。

是否可以?

I have asp.net label that his text is binding from the SQL.
If the text contains 'x' - I need to make this label to linkButton.
Is it possible?

推荐答案

你可以隐藏原始控件并将其文本交换为新文件。

you can hide the original control and swap its text to the new.
if label1.text = "xxx" then
label1.visible = false
linkbutton1.postbackurl = label1.text
linkbutton1.visible = true
else

end if


Reserve身体上的占位符,然后根据if条件动态插入标签或链接按钮。

1. https://msdn.microsoft.com/en-us/library/kyt0fzt1(v = vs.140).aspx [ ^ ]

2. http://www.dotnetfunda.com/articles / show / 2394 / create-link-button-dynamic-in-aspnet-csharp [ ^ ]
Reserve a place holder on the body, then insert into it a label or link button dynamically based on if else condition.
1. https://msdn.microsoft.com/en-us/library/kyt0fzt1(v=vs.140).aspx[^]
2. http://www.dotnetfunda.com/articles/show/2394/create-link-button-dynamically-in-aspnet-csharp[^]


这篇关于将标签转为链接按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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