473,387 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

hide drowndownList

JFB
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: _ctl0:DropDownList2"
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
Nov 1 '06 #1
5 1020
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" <he**@jfb.comwrote in message
news:Op**************@TK2MSFTNGP03.phx.gbl...
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: _ctl0:DropDownList2"
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

Nov 1 '06 #2
JFB
Tks for you reply...
How can I do that? Sorry but I dpn't get it
Rgds
JFB

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:er**************@TK2MSFTNGP04.phx.gbl...
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" <he**@jfb.comwrote in message
news:Op**************@TK2MSFTNGP03.phx.gbl...
>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 :_ctl0:DropDownList2"
id="Left_g_708f9018_c320_46a1_bb9c_ebb3b67b8184__ ctl0_DropDownList2"

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

How can I do it now??
Tks

JFB


Nov 2 '06 #3
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" <he**@jfb.comwrote in message
news:Op**************@TK2MSFTNGP03.phx.gbl...
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: _ctl0:DropDownList2"
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

Nov 2 '06 #4
JFB
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" <RE**************************@mMvVpPsS.orgwrote in
message news:uI**************@TK2MSFTNGP03.phx.gbl...
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" <he**@jfb.comwrote in message
news:Op**************@TK2MSFTNGP03.phx.gbl...
>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 :_ctl0:DropDownList2"
id="Left_g_708f9018_c320_46a1_bb9c_ebb3b67b8184__ ctl0_DropDownList2"

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

How can I do it now??
Tks

JFB


Nov 2 '06 #5
JFB
Never Mine Eliyahu... I got it...
I use only _DropDownList2 as name.
Tks
JFB
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:uI**************@TK2MSFTNGP03.phx.gbl...
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" <he**@jfb.comwrote in message
news:Op**************@TK2MSFTNGP03.phx.gbl...
>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 :_ctl0:DropDownList2"
id="Left_g_708f9018_c320_46a1_bb9c_ebb3b67b8184__ ctl0_DropDownList2"

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

How can I do it now??
Tks

JFB


Nov 2 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Steve | last post by:
Visual Studio 2003 C# Windows: I have a tree view control as my main menu control down the left side of my application. This has 2 Parent Nodes on it (Jobs and Employees). beneath these 2 main...
3
by: alex | last post by:
I'd like to have a show/hide widget on my web site, kind of like "show details" / "hide details" in Google Groups. Is there a tutorial explaining how to make them? Google's is a bit complex and...
0
by: Efkas | last post by:
I have a full custom application with some widged extending Controls like Label and PictureBox. I build a menu with these widgets. When I click on one of them, it calls a function to display...
7
by: FP | last post by:
I'm new to Java Script. I'm displaying comments people have made. Below each persons' comment I want to add 2 buttons "Reply" and "Amend". Clicking "Reply" would display an empty text field...
5
by: ali | last post by:
Hello every one i need you help regarding div hide and show. i am having a link like <a href="#" onClick="expandWin()">show/hide </a> <div id=showHide> </div> within div i have lots of...
1
by: pamate | last post by:
hi, I want to show hide layers. I am able to show and hide layers but i am facing problem that, cant view the cursor in Mozilla,but i can type in input text box, its overlapping the layers. ...
3
by: Bob | last post by:
I have a static AutoPostBack asp:DrownDownList and depending on the selected content of this list, I want to either 1) not do anything or 2) generate and populate a new asp:DrownDownList below it. ...
6
by: Ralph | last post by:
Hi, I was reading effictive C++ and some other books again and they all tell you about hiding implementation details (proxy/pimpl/inheritance) but they never really explain when to use it. I...
6
by: Doogie | last post by:
Hi I have an img control I am trying to hide upon certain types of commands in my code behind. When to hide it is directly tied to a asp:dropdownlist control. So depending on what the user...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.