473,387 Members | 1,536 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.

setting Onclick and setting the ClientID in behind code isn't working in Mozilla

I'm reposting hoping to get a reply, my last one got bumped down
because I posted in the late day.

Hi,

I have in my behind code a user control with the following in Page
Load:

this.btn.Attributes.Add("onclick", "SetDivder(" +
this.divContainer.ClientID + ");");

In Internet Explorer I can press the button of the usr control and use
the object that is pass to the javascript function. In Mozilla, when I
click the button nothing happens.
For Mozilla if I remove the "this.divContainer.ClientID" and replace
it with"null" or just pass no parameters to the javascript function I
am then able to do alert('test'), but if I pass in at all
"this.divContainer.ClientID" to the javascript function the
alter('test'); will never fire. Is there a reason why you can't
predefine an object or what is being passed into the javascript
function in Mozilla, but can in Internet Explorere? Also, I have my
javascript function declared one time in the main.aspx page, so
dropping mutliple user controls on the same page will not create
multiple defintions of the javascipt function:

function SetDivder() //doesn't work if you put SetDivider(obj) and
pass in ClientID
{
alert('test')

}

Thanks,

David

Aug 22 '06 #1
2 2703
Try this:

this.btn.Attributes.Add("onclick", "SetDivder('" +
this.divContainer.ClientID + "');");

-- I put single quotes around the "this.divContainer.ClientID" - which is a
string.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"da****@sharpesoft.com" wrote:
I'm reposting hoping to get a reply, my last one got bumped down
because I posted in the late day.

Hi,

I have in my behind code a user control with the following in Page
Load:

this.btn.Attributes.Add("onclick", "SetDivder(" +
this.divContainer.ClientID + ");");

In Internet Explorer I can press the button of the usr control and use
the object that is pass to the javascript function. In Mozilla, when I
click the button nothing happens.
For Mozilla if I remove the "this.divContainer.ClientID" and replace
it with"null" or just pass no parameters to the javascript function I
am then able to do alert('test'), but if I pass in at all
"this.divContainer.ClientID" to the javascript function the
alter('test'); will never fire. Is there a reason why you can't
predefine an object or what is being passed into the javascript
function in Mozilla, but can in Internet Explorere? Also, I have my
javascript function declared one time in the main.aspx page, so
dropping mutliple user controls on the same page will not create
multiple defintions of the javascipt function:

function SetDivder() //doesn't work if you put SetDivider(obj) and
pass in ClientID
{
alert('test')

}

Thanks,

David

Aug 22 '06 #2
That worked. Thank you! As I noticed in IE when you exclude the
singal qutoes it passes in the specific object. Mozilla doesn't
interpret the straight ClientID as an object. By adding the single
quotes the ClientID is passed in as a string and then I just leverage
the document.getelementbyID('test') to get the object and use it, which
both ID and Mozilla interpret.

Again,

Thanks,

David

Aug 22 '06 #3

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

Similar topics

3
by: Jim Mitchell | last post by:
I have some code behind that generates 10 imagebutton controls.... I can not seem to figure out how to trap the onclick event for each image and determine which image was clicked. Can someone...
9
by: Guus Ellenkamp | last post by:
I want to use a second window to link to and put new content in it and pop up is some link is clicked. How to set the focus to the second window if it's already open. With what I do now, the window...
12
by: Jim Tome | last post by:
Hi, I am trying to change and pass the value of a hidden input type on a form tag to a cgi processing script based on the value of a checkbox within the form: function CheckBoxes () { if...
1
by: ofirpicazo | last post by:
Hi, my problem is that IE doesn't seem to do what it's supposed to, so I hope u guys can give me a hand. The code below is supposed to make text editable whenever it's clicked, and it works, the...
4
by: Mark Rae | last post by:
Hi, VS.NET 2003 on WinXPPro, both with all the latest patches and updates, etc... I've got a very simple WebForm which is used either to add a new record to a SQL Server database or edit a...
2
by: Earl Teigrob | last post by:
I am trying to build a custom control to wrap my smart navigation implimention (not microsofts 'cause it has problems) The follow code works fine when the onclick and onload events are defined in...
2
by: Corno | last post by:
Hi all, I have a page with a table of which the rows have to be added dynamically. What I also want is 'code behind' the onclick event of a row (the page should be posted back to the server,...
0
by: davidr | last post by:
Hi, I have in my behind code a user control with the following in Page Load: this.btn.Attributes.Add("onclick", "SetDivder(" + this.divContainer.ClientID + ");"); In Internet Explorer I...
2
by: VMI | last post by:
In the Page_Load() of my webForm, I have the following code, and on my HTML button, the onclick button calls writeVal() (the javascript function). When I click on the button, I see the messagebox...
4
by: Big Moxy | last post by:
test page - http://projects.missioninternet.com/proweb/clients/test.php. When I added the onclick event so that I could employ ajax on this page the stylesheet formatting for this <lidisappeared....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.