HTML单选按钮隐藏,C#和HTML,Javascript, [英] HTML Radio Button Hiding, C# and HTML, Javascript,

查看:104
本文介绍了HTML单选按钮隐藏,C#和HTML,Javascript,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有人,



i有以下输入单选按钮配置,在我的代码后面如果值设置为true,我想隐藏它们。任何帮助都会很棒



 <   asp:Panel     ID   =  pnlAd    runat   = 服务器 >  
< 输入 < span class =code-attribute> id = Prior 名称 = rblAd type = radio value = - 2 class = s2
önclick =' rblAd_onClick(event); ' / >
< asp:标签 ID = lblPriorAd runat = 服务器 CssClass = s1 文字 = 以前的广告 >
< 输入 id = 当前 name = rblAd type = radio value = -1 class = s2
< span class =code-attribute> önclick =' rblAd_onClick(event);' / > < asp:标签 ID < span class =code-keyword> = lblCurrentAd runat = server CssClass = s1
< span class =code-attribute> < span class =code-attribute> 文字 = 当前广告&打印 >
< 输入 id = 下一步 name = rblAd 类型 = radio value = < span class =code-keyword> 0 class = s2
önclick =' rblAd_onClick(event);' / > < asp:标签 ID = lblThisAd runat = server CssClass = s1
< span class =code-attribute> 文本 = 下一个广告 >
< input id = 未来 < span class =code-attribute> name = rblAd type = radio value = 1 class = s2
önclick =' rblAd_onClick(event);' < span class =code-attribute> / > < asp:标签 ID = lblNextAd runat = server < span class =code-attribute> CssClass = s1
文本 = 广告准备 >
< br / > < asp:标签 ID = lblDateFrom runat < span class =code-keyword> = server CssClass = s1 文字 = 广告来自 >

解决方案

在Javascript中在设计端编写一个函数,它接受你想要隐藏的那个控件的硬编码id。



和代码隐藏调用这个功能带有你想要的ID。



就像代码背后一样。





  if  value 
{
ScriptManager.RegisterStartupScript( this .Page, this .GetType(), blah makeInvisible(' + parm + '););

}







这里 param 是你必须将radiobutton id作为参数传递的参数,而 makeInvisible()是Javascript函数,它将获取Radiobutton id并将禁用它。



希望这会有所帮助。 :)


Hey Everyone,

i have the below input radio button configuration, and in my code behind if a value is set to true, i want to hide on of them. Any help would be great

<asp:Panel ID="pnlAd" runat="server">
               <input id="Prior" name="rblAd" type="radio" value="-2" class="s2"
                    önclick='rblAd_onClick(event);' />
               <asp:Label ID="lblPriorAd" runat="server" CssClass="s1" Text="Prior Ad">
               <input id="Current"  name="rblAd" type="radio" value="-1" class="s2"
                    önclick='rblAd_onClick(event);' /><asp:Label ID="lblCurrentAd" runat="server" CssClass="s1"
                       Text="Current Ad & Print">
               <input id="Next"  name="rblAd" type="radio" value="0" class="s2"
                    önclick='rblAd_onClick(event);' /><asp:Label ID="lblThisAd" runat="server" CssClass="s1"
                       Text="Next Ad">
               <input id="Future"  name="rblAd" type="radio" value="1" class="s2"
                    önclick='rblAd_onClick(event);' /><asp:Label ID="lblNextAd" runat="server" CssClass="s1"
                       Text="Ad Prep">
                 <br /><asp:Label ID="lblDateFrom" runat="server" CssClass="s1" Text="Ad From">

解决方案

Write a function in design side in Javascript which takes the hardcoded id of that control which you wants to make invisible.

and from the codebehind call that function with your desired id.

like from code behind.


if(value)
{
 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "blah", "makeInvisible('" + parm + "');", true);

}




here param is the parameter in which you have to pass radiobutton id as parameter, and makeInvisible() is the Javascript function which will take Radiobutton id and will disable it.

Hope this will help. :)


这篇关于HTML单选按钮隐藏,C#和HTML,Javascript,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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