Problem: Open new browser window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nashak@hotmail.com

    #1

    Problem: Open new browser window

    Hello,

    I have a aspx page on which I have a button. In the click event method
    in code-behind I do some processing and now need to open a new window
    in another browser and pass a couple of parameters.


    I included in my aspx file, the following js function:


    function OpenChecklist(s trCaseID)
    {
    var url = "/ABC/DEF.aspx?qsSubj ectID=" + strSubjectID
    var f =
    "width=700,heig ht=450,left=75, top=75,status=n o,toolbar=no,me nubar=no,locati ­on=no";

    window.open(url ,"Subject Checklist",f)



    }


    My codebehind has the following
    Public Sub cmdSubject_Serv erClick(ByVal sender As System.Object, ByVal
    e As System.EventArg s) Handles cmdSubject.Serv erClick

    --do some processing here
    -- now would like a way to call the method (passing some parameters)
    and opening a new browser window


    End Sub


    Now how do I call this function, not from the onclick() event but from
    within the click event procedure?


    One way I was told is using onload function. Would appreciate is
    someone could provide some more details on how to do this?

  • UsualDosage

    #2
    RE: Problem: Open new browser window

    This isn't really doable server side, but there are ways to work around it.
    Opening a "popup" window is a client side action, performed using JavaScript.

    What you will want to do is apply the JavaScript for your "cmdSubject "
    button. To do this:

    cmdSubject.Attr ibutes.Add("onc lick", "OpenCheckList( strCaseId)");

    In this way, you won't have to perform a postback to popup the new window.
    However, you will need to find a way to pass the variable "strCaseId" to the
    JavaScript function. I would suggest storing this in a hidden field, or an
    invisible div.

    --
    "Quae narravi, nullo modo negabo."


    "nashak@hotmail .com" wrote:
    Hello,
    >
    I have a aspx page on which I have a button. In the click event method
    in code-behind I do some processing and now need to open a new window
    in another browser and pass a couple of parameters.
    >
    >
    I included in my aspx file, the following js function:
    >
    >
    function OpenChecklist(s trCaseID)
    {
    var url = "/ABC/DEF.aspx?qsSubj ectID=" + strSubjectID
    var f =
    "width=700,heig ht=450,left=75, top=75,status=n o,toolbar=no,me nubar=no,locati ­on=no";
    >
    window.open(url ,"Subject Checklist",f)
    >
    >
    >
    }
    >
    >
    My codebehind has the following
    Public Sub cmdSubject_Serv erClick(ByVal sender As System.Object, ByVal
    e As System.EventArg s) Handles cmdSubject.Serv erClick
    >
    --do some processing here
    -- now would like a way to call the method (passing some parameters)
    and opening a new browser window
    >
    >
    End Sub
    >
    >
    Now how do I call this function, not from the onclick() event but from
    within the click event procedure?
    >
    >
    One way I was told is using onload function. Would appreciate is
    someone could provide some more details on how to do this?
    >
    >

    Comment

    Working...