具有一个ID的href,不能在代码中调用 [英] a href having one id ,cant be called in code

查看:79
本文介绍了具有一个ID的href,不能在代码中调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用a href,默认情况下即时通讯使用样式display:none,现在通过检查条件使链接可见,但即时通讯收到id在当前上下文中不存在的错误,请建议我解决方案或任何替代方法

i m using one a href and by default i m using the style display:none,now by checking the conditions i want to make that link visible ,but i m getting the error that the id is not present in current context,please suggest me the solution or any alternatives

推荐答案

不要使用display:none,将Visible属性设置为false,并在将条件设置为true以后进行检查.
希望它对您有帮助
Dont use display:none, use Visible property to false, and after checking the condition set visible to true

I hope it helps you


因为href是HTML控件而不是服务器端控件,因此您不能在编码页上通过其ID调用它.
为此,可以使用链接按钮,并且可以设置不显示或不显示,并设置可见的true或false.您可以同时使用这两个属性,因为它是服务器端控件.
Because href is HTML control not of server side control so you cannot call it by its id on the coding page.
for this use can use link button and in that you can set display none or block and set visible true or false. You can use both properties because it is a server side control.
<asp:linkbutton id="lnkBtn" runat="server" visible="false" xmlns:asp="#unknown"></asp:linkbutton>


在.cs页面上:


on .cs page :

lnkBtn.Visible=true;


还有


And

<asp:linkbutton id="lnkBtn" runat="server" style="display:none" xmlns:asp="#unknown"></asp:linkbutton>


在.cs页面上:


on .cs page :

lnkBtn.Style.Add("display", "block");



希望对您有帮助.
如果有帮助,请不要忘记将其标记为答案. :)



Hope it''ll help you.
Don''t forget to mark as answer if it helps. :)


这篇关于具有一个ID的href,不能在代码中调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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