List Info

Thread: RE: Hide/show the option tag of select element




RE: Hide/show the option tag of select element
country flaguser name
United States
2008-05-07 11:50:06
Don't you want to set the attribute dynamically?  It looks like it needs to happen either by hiding the option on the server by going through the ddl.Items and comparing it to some value, or in javascript based on a value in another control.  Did you see the prior javascript I posted?
 
-Server
 
ddl.DataBind()
For each li in ddl.Items
   if li.value = somevalue then
      li.attributes.add("style","display:none")
      Exit For
   End If
Next
 
-client
 
var ddl = document.forms[0].ddlBox
var items = ddl.options.length;
var blnGotIt = false;
var li = null;
for(i=0;i<items;i++)
{
 ; &nbsp; if(ddl.options[i].value.toUpperCase() = someValue.toUpperCase())
 ; &nbsp; {
   ; &nbsp; &nbsp;  li = ddl.options[i]
&nbsp; &nbsp; &nbsp; &nbsp;  li.style.display = "none";
  ; &nbsp; &nbsp; &nbsp; break;
&nbsp;   }
}
&nbsp;
if(!blnGotIt)
{
 &nbsp;  if(li != null)
&nbsp; &nbsp; {
   ; &nbsp;  li.style.display = "block";
 &nbsp; &nbsp; }
}

&gt; Subject: [aspnet-databases] RE: Hide/show the option tag of select element
&gt; CC: aspnet-databasesaspadvice.com
> From: Jayshree_Shahfpl.com
&gt; Date: Tue, 6 May 2008 07:24:13 -0700
> To: aspnet-databasesaspadvice.com
>
> I am trying to hide the option tag of select element based on the key
> values from WEB config file
>
> I try simply with option's disable, display and visible attributes of style
> but none of them works.
>;
> Here is what I would like accomplish
>
> <select>
> <option value = 1 style:display:none>;option 1
> <option values = 2>option 2
> </select>
>
> Thanks in advance for all your help.
>
>
>
> |---------+---------------------------->
> | | "Duane Lakoduk" |
> | | <duanelakodukcom|
> | | cast.net&gt; |
> | | |
> | | 05/03/2008 07:35 |
> | | PM |
> | | Please respond to|
> | | aspnet-databases |
> | | |
> |---------+---------------------------->
> >------------------------------------------------------------------------------------------------------------------------------|
> | |
> | To: aspnet-databasesaspadvice.com |
> | cc: |
> | Subject: [aspnet-databases] RE: Hide/show the option tag of select element |
> >------------------------------------------------------------------------------------------------------------------------------|
>
>
>
>
> What are the conditions under which you want to Hide/show the option?
&gt;
> If you are using a datasource for your DropDownList, you could just reload
>; your list and exclude the ListItem you want to hide.
>
> Send more details of what you are trying to accomplish.
>
> //Duane
&gt;
> -----Original Message-----
> From: Jayshree_Shahfpl.com [mailto:Jayshree_Shahfpl.com]
&gt; Sent: Thursday, May 01, 2008 12:40 PM
> To: aspnet-databasesaspadvice.com
> Cc: aspnet-databasesaspadvice.com
> Subject: [aspnet-databases] Hide/show the option tag of select element
&gt;
> All,
>
> How can I Hide/show the option tag of select element in ASP page?
>
> Thanks in advance for all your help.
>
>
>
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com Need XML Advice?
&gt; http://xmladvice.com
>
>
>
>
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
> Need XML Advice? http://xmladvice.com
>
>
>
>
>
>
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
> Need XML Advice? http://xmladvice.com



Get Free (PRODUCT) RED™ Emoticons, Winks and Display Pics. Check it out! Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )