Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2003, 01:32 AM
Registered User
 
Join Date: Jun 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default javascript clientID reference in composite control

Hi all!

I have a problem with referencing a clientID in javascript using a composite asp.net control.

I have created a ASP.Net server composite control (navigationMenu)which uses some clientside Javascript. I have set clientside events bij adding attributes to serverside controls, like:

cell.Attributes.Add("onmouseover", "javascript:ShowSubMenu('" & SubMenu.ClientID & "');")

ClientID of the submenu in this case is something like "SubMenu1_2_1"
Works nice but when I run the app the clientID is referred to as:
"_ctl0_NavigationMenu1_SubMenu_1_2_1". (so I get an error, since he cant find the object)

Quite logic, since the controls on the compositecontrol always get the ID of the parent to make it unique.

The problem is: how do I get a reference to "_ctl0_NavigationMenu1_SubMenu_1_2_1"?

I am sure there is an easy way of doing this, but its always hard to find an easy solution. :)

Any ideas anyone?

Thanx in advance!
 
Old June 4th, 2003, 02:13 AM
Registered User
 
Join Date: Jun 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default


I found a very simple solution, as aspected :)

I used the clientID of the parent control to build the right reference:

cell.Attributes.Add("onmouseover", "javascript:ShowSubMenu('" & Parent.ClientID & "_" & SubMenu.ClientID & "');")
ArjenO





Similar Threads
Thread Thread Starter Forum Replies Last Post
Reference to uninitialized composite Indrajit.Pal Oracle 2 March 10th, 2008 09:25 AM
Chp.5 composite control properties studen77 BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 1 October 6th, 2006 03:35 PM
Composite Control Part 2 origjones General .NET 2 September 18th, 2006 03:28 AM
PLEASE HELP - Composite Control brettk_1 ASP.NET 1.0 and 1.1 Professional 0 August 3rd, 2005 06:22 AM
Composite Control bmains .NET Framework 2.0 0 July 25th, 2005 12:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.