Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > hide drowndownList

Reply
Thread Tools

hide drowndownList

 
 
JFB
Guest
Posts: n/a
 
      11-01-2006
Hi all,
This is crazy...
The name of my dropdownlist on the ascx page is:
nameOfMyControl_DropDownListName
Like:
contactWebUserControl_DropDownList2
Now I put my ascx in sharepoint and the name is :
<select
name="Left:g_708f9018_c320_46a1_bb9c_ebb3b67b8184: _ctl0ropDownList2"
id="Left_g_708f9018_c320_46a1_bb9c_ebb3b67b8184__c tl0_DropDownList2"

I have a fuction in java to catch this name as:
var drop2 = document.getElementById("contactWebUserControl_Dro pDownList2");

How can I do it now??
Tks

JFB


 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      11-01-2006
you have to link to JavaScript through code behind. This will catch the name
no matter what it is at run time.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
"JFB" <(E-Mail Removed)> wrote in message
news:OpnbIzf$(E-Mail Removed)...
> Hi all,
> This is crazy...
> The name of my dropdownlist on the ascx page is:
> nameOfMyControl_DropDownListName
> Like:
> contactWebUserControl_DropDownList2
> Now I put my ascx in sharepoint and the name is :
> <select
> name="Left:g_708f9018_c320_46a1_bb9c_ebb3b67b8184: _ctl0ropDownList2"
> id="Left_g_708f9018_c320_46a1_bb9c_ebb3b67b8184__c tl0_DropDownList2"
>
> I have a fuction in java to catch this name as:
> var drop2 =
> document.getElementById("contactWebUserControl_Dro pDownList2");
>
> How can I do it now??
> Tks
>
> JFB
>



 
Reply With Quote
 
 
 
 
JFB
Guest
Posts: n/a
 
      11-02-2006
Tks for you reply...
How can I do that? Sorry but I dpn't get it
Rgds
JFB

"Cowboy (Gregory A. Beamer)" <(E-Mail Removed)> wrote in
message news:erMBwjg$(E-Mail Removed)...
> you have to link to JavaScript through code behind. This will catch the
> name no matter what it is at run time.
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> http://gregorybeamer.spaces.live.com
>
> *************************************************
> Think outside of the box!
> *************************************************
> "JFB" <(E-Mail Removed)> wrote in message
> news:OpnbIzf$(E-Mail Removed)...
>> Hi all,
>> This is crazy...
>> The name of my dropdownlist on the ascx page is:
>> nameOfMyControl_DropDownListName
>> Like:
>> contactWebUserControl_DropDownList2
>> Now I put my ascx in sharepoint and the name is :
>> <select
>> name="Left:g_708f9018_c320_46a1_bb9c_ebb3b67b8184: _ctl0ropDownList2"
>> id="Left_g_708f9018_c320_46a1_bb9c_ebb3b67b8184__c tl0_DropDownList2"
>>
>> I have a fuction in java to catch this name as:
>> var drop2 =
>> document.getElementById("contactWebUserControl_Dro pDownList2");
>>
>> How can I do it now??
>> Tks
>>
>> JFB
>>

>
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      11-02-2006
This javascript function will help you. Call it as

var drop2 = findControl("select", "contactWebUserControl_DropDownList2");

function findControl(tagName, controlId)
{
var aControls = document.getElementsByTagName(tagName);
if (aControls==null)
return null;
for (var i=0; i< aControls.length; i++)
{
var j = aControls[i].id.lastIndexOf(controlId);
if ((j > -1) && (j == (aControls[i].id.length - controlId.length)))
return aControls[i];
}
return null;
}


--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


"JFB" <(E-Mail Removed)> wrote in message
news:OpnbIzf$(E-Mail Removed)...
> Hi all,
> This is crazy...
> The name of my dropdownlist on the ascx page is:
> nameOfMyControl_DropDownListName
> Like:
> contactWebUserControl_DropDownList2
> Now I put my ascx in sharepoint and the name is :
> <select
> name="Left:g_708f9018_c320_46a1_bb9c_ebb3b67b8184: _ctl0ropDownList2"
> id="Left_g_708f9018_c320_46a1_bb9c_ebb3b67b8184__c tl0_DropDownList2"
>
> I have a fuction in java to catch this name as:
> var drop2 =
> document.getElementById("contactWebUserControl_Dro pDownList2");
>
> How can I do it now??
> Tks
>
> JFB
>



 
Reply With Quote
 
JFB
Guest
Posts: n/a
 
      11-02-2006
Tks for you reply Eliyahu,
Looks like it works but I got an error "style" is null or not an object.
What is this mean? Any ideas?
Rgds

JFB


"Eliyahu Goldin" <(E-Mail Removed)> wrote in
message news:uIrs7jl$(E-Mail Removed)...
> This javascript function will help you. Call it as
>
> var drop2 = findControl("select", "contactWebUserControl_DropDownList2");
>
> function findControl(tagName, controlId)
> {
> var aControls = document.getElementsByTagName(tagName);
> if (aControls==null)
> return null;
> for (var i=0; i< aControls.length; i++)
> {
> var j = aControls[i].id.lastIndexOf(controlId);
> if ((j > -1) && (j == (aControls[i].id.length - controlId.length)))
> return aControls[i];
> }
> return null;
> }
>
>
> --
> Eliyahu Goldin,
> Software Developer & Consultant
> Microsoft MVP [ASP.NET]
>
>
> "JFB" <(E-Mail Removed)> wrote in message
> news:OpnbIzf$(E-Mail Removed)...
>> Hi all,
>> This is crazy...
>> The name of my dropdownlist on the ascx page is:
>> nameOfMyControl_DropDownListName
>> Like:
>> contactWebUserControl_DropDownList2
>> Now I put my ascx in sharepoint and the name is :
>> <select
>> name="Left:g_708f9018_c320_46a1_bb9c_ebb3b67b8184: _ctl0ropDownList2"
>> id="Left_g_708f9018_c320_46a1_bb9c_ebb3b67b8184__c tl0_DropDownList2"
>>
>> I have a fuction in java to catch this name as:
>> var drop2 =
>> document.getElementById("contactWebUserControl_Dro pDownList2");
>>
>> How can I do it now??
>> Tks
>>
>> JFB
>>

>
>



 
Reply With Quote
 
JFB
Guest
Posts: n/a
 
      11-02-2006
Never Mine Eliyahu... I got it...
I use only _DropDownList2 as name.
Tks
JFB


"Eliyahu Goldin" <(E-Mail Removed)> wrote in
message news:uIrs7jl$(E-Mail Removed)...
> This javascript function will help you. Call it as
>
> var drop2 = findControl("select", "contactWebUserControl_DropDownList2");
>
> function findControl(tagName, controlId)
> {
> var aControls = document.getElementsByTagName(tagName);
> if (aControls==null)
> return null;
> for (var i=0; i< aControls.length; i++)
> {
> var j = aControls[i].id.lastIndexOf(controlId);
> if ((j > -1) && (j == (aControls[i].id.length - controlId.length)))
> return aControls[i];
> }
> return null;
> }
>
>
> --
> Eliyahu Goldin,
> Software Developer & Consultant
> Microsoft MVP [ASP.NET]
>
>
> "JFB" <(E-Mail Removed)> wrote in message
> news:OpnbIzf$(E-Mail Removed)...
>> Hi all,
>> This is crazy...
>> The name of my dropdownlist on the ascx page is:
>> nameOfMyControl_DropDownListName
>> Like:
>> contactWebUserControl_DropDownList2
>> Now I put my ascx in sharepoint and the name is :
>> <select
>> name="Left:g_708f9018_c320_46a1_bb9c_ebb3b67b8184: _ctl0ropDownList2"
>> id="Left_g_708f9018_c320_46a1_bb9c_ebb3b67b8184__c tl0_DropDownList2"
>>
>> I have a fuction in java to catch this name as:
>> var drop2 =
>> document.getElementById("contactWebUserControl_Dro pDownList2");
>>
>> How can I do it now??
>> Tks
>>
>> JFB
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic asp:DrownDownList control Bob ASP .Net 3 12-07-2007 05:01 PM
How to selectively hide Wireless Network Connection icon =?Utf-8?B?SmFtZXM=?= Wireless Networking 1 10-27-2005 10:18 PM
Ports to open to the firewall (Hide Nat, Cisco VPN) Alabama Circus Cisco 1 06-04-2005 12:15 PM
[HIDE LAN] Hide a part of hosts into the LAN at VPN users? Paolo Bresi Cisco 1 04-04-2005 02:41 PM
"Hide Selection" - can this be remembered? Scott McNair ASP .Net 1 06-17-2004 02:26 PM



Advertisments