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

Discussion in 'ASP .Net' started by davidr@sharpesoft.com, Aug 22, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Miller [msft]

    Re: Code Behind vs. no code behind: error

    Ben Miller [msft], Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    826
    Alphonse Giambrone
    Jun 28, 2003
  2. Maras
    Replies:
    1
    Views:
    3,458
    Cowboy \(Gregory A. Beamer\)
    Oct 15, 2003
  3. =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=

    Fire Code behind code AND Javascript code associated to a Button Click Event

    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    21,760
    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=
    Feb 11, 2004
  4. Corno
    Replies:
    2
    Views:
    23,533
    Eliyahu Goldin
    Sep 5, 2004
  5. keithb
    Replies:
    1
    Views:
    1,189
    Bruce Barker
    Mar 29, 2006
  6. Replies:
    2
    Views:
    1,335
  7. John

    Non-code behind to code behind

    John, Feb 19, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    719
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 19, 2007
  8. Corno

    Code behind and onclick on html table row

    Corno, Sep 3, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    254
    Eliyahu Goldin
    Sep 5, 2004
Loading...