Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 18th, 2006, 01:38 PM
Authorized User
Points: 239, Level: 4
Points: 239, Level: 4 Points: 239, Level: 4 Points: 239, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jul 2005
Location: , , .
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing asp control id to javascript

I am trying to call a Javascript function that will receive the ID of two asp listbox controls. I then would like to set these id's to variables that I will declare in the javascript. The function call is in bold below. It is done in codebehind.

((HtmlInputButton)e.Item.FindControl("btnPutIn")). Attributes.Add("onclick","moveSelectedOptions(docu ment.getElementById('"+e.Item.FindControl("lbOut") .ClientID+"'),document.getElementById('"+e.Item.Fi ndControl("lbIn").ClientID+"'),false);JASONSNEWFUNCTION(document.getElementById('"+e.Ite m.FindControl("lbIn").ClientID+"'),document.getEle mentById('"+e.Item.FindControl("txtDisplayText").C lientID+"'),false);return false;");

Javascript function looks like this, it exists in a separate js file:

function JASONSNEWFUNCTION(lbin,txtdisplay) {

var mylist=document.getElementById("lbin");

var mydisplay=document.getElementById("txtdisplay");


Visual Studio keeps telling me that my declared variables have a null value. But lbin and txtdispay do bring back id's when i check their values in the immediate window. I am very confused.I know that the function is being called. ( a good thing I guess!) Is there something wrong with my getElementById statement?



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing values from asp to a javascript Abhilash Classic ASP Basics 11 June 15th, 2011 12:38 PM
Getting id of a control in javascript sudhir164 Javascript How-To 2 February 23rd, 2008 05:35 AM
Master pages &server control ID - asp.net 2.0 tech user C# 2005 1 August 3rd, 2006 04:31 AM
how to get ID of server-control in Javascript? hertendreef ASP.NET 2.0 Basics 0 June 15th, 2006 12:05 PM
Get the Id of Control in ASP rekha_jsr Classic ASP Professional 2 June 14th, 2006 07:37 AM

All times are GMT -4. The time now is 10:40 AM.

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