[CLOSED] Call Javascript Function

  1. #1

    [CLOSED] Call Javascript Function

    Hi,

    I have used a javascript function in aspx page.
    function VisibleCtl(bMark, bNew, bEdit, bSave, bAttach, bEmail, bMove, bExit) {
    <!--Code -->
    }
    I am trying to call this function from code behind for using following method.

    bool hasShowMark = false;
    bool hasShowNew = false;
    bool hasShowEdit = false;
    bool hasShowSave = false;
    bool hasShowMove = false;
    bool hasShowMail = false;
    bool hasShowAttach = false;
    bool hasShowExit = true;
    this.ScriptManager1.AddScript("VisibleCtl(" + hasShowMark + "," + hasShowNew + "," + hasShowEdit + "," + hasShowSave + "," + hasShowAttach + "," + hasShowMail + "," + hasShowMove + "," + hasShowExit + ");");
    But it is showing exception.
    Click image for larger version. 

Name:	issue..jpg 
Views:	160 
Size:	40.1 KB 
ID:	1392



    Regards,

    Rameshkumar.T
    Last edited by geoffrey.mcgill; Jul 21, 2010 at 4:04 AM.
  2. #2
    Hi,

    Javascript is case sensitive language. Bool javascript consts - true, false (not True,False)
    Please use
    this.ScriptManager1.AddScript("VisibleCtl(" + JSON.Serialize(hasShowMark) + "," + JSON.Serialize(hasShowNew) + "," + JSON.Serialize(hasShowEdit) + "," + JSON.Serialize(hasShowSave) + "," + JSON.Serialize(hasShowAttach) + "," + JSON.Serialize(hasShowMail) + "," + JSON.Serialize(hasShowMove) + "," + JSON.Serialize(hasShowExit) + ");");
  3. #3

    Call Javascript Function

    Quote Originally Posted by vladimir View Post
    Hi,

    Javascript is case sensitive language. Bool javascript consts - true, false (not True,False)
    Please use
    this.ScriptManager1.AddScript("VisibleCtl(" + JSON.Serialize(hasShowMark) + "," + JSON.Serialize(hasShowNew) + "," + JSON.Serialize(hasShowEdit) + "," + JSON.Serialize(hasShowSave) + "," + JSON.Serialize(hasShowAttach) + "," + JSON.Serialize(hasShowMail) + "," + JSON.Serialize(hasShowMove) + "," + JSON.Serialize(hasShowExit) + ");");
    I forgot to check case sensitive. Now its working

    Thanks

Similar Threads

  1. Call JavaScript function with CellSelection
    By bolzi89 in forum 1.x Help
    Replies: 5
    Last Post: Dec 23, 2011, 2:42 PM
  2. Replies: 8
    Last Post: Dec 23, 2011, 12:41 PM
  3. How to call the javascript function form code behind
    By harshad.jadhav in forum 1.x Help
    Replies: 3
    Last Post: Mar 29, 2011, 3:00 PM
  4. [CLOSED] How to call a javascript function from a child page?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 25, 2010, 5:40 PM
  5. Replies: 1
    Last Post: Jun 03, 2009, 12:10 PM

Tags for this Thread

Posting Permissions