Scripting using button

Discussion in 'ASP .Net' started by stephen, Aug 27, 2007.

  1. stephen

    stephen Guest

    Hi all,

    I found a nice piece of code that helps me select a value from a datagrid
    (second page) and pass the value to the calling page (first page)... but If
    I need multiple values then the script fails, I am not good at scripting,
    can someone please help me

    this is the code:

    <INPUT id=btnFind
    onclick="document.getElementById('lbContractNum').innerHTML =
    window.showModalDialog('FindContract.aspx?'+document.getElementById('lbContractNum').innerHTML,
    '','width=300,height=300');"
    type=button size=5 value=Find... name=findContract>

    How can pass parameters to get multiple values using the same click event
    for eg:

    I want to try

    <INPUT id=btnFind
    onclick="document.getElementById('lbContractNum').innerHTML =
    window.showModalDialog('FindContract.aspx?'+document.getElementById('lbContractNum').innerHTML,
    document.getElementById('lbContractName').innerHTML =
    window.showModalDialog('FindContract.aspx?'+document.getElementById('lbContractName').innerHTML
    '','width=300,height=300');"
    type=button size=5 value=Find... name=findContract>

    I get script errors,

    thanks for your help,
    Stephen
    stephen, Aug 27, 2007
    #1
    1. Advertising

  2. stephen

    Steve Guest

    I would try it this way:

    <INPUT id=btnFind
    onclick="document.getElementById('lbContractNum').innerHTML =

    window.showModalDialog('FindContract.aspx?num='+document.getElementById('lbContractNum').innerHTML
    + '&name=' + document.getElementById('lbContractName').innerHTML,
    '','width=300,height=300');"
    type=button size=5 value=Find... name=findContract>

    Basically, you want to separate the values you're passing with a "&"
    character. Another thing, you normally pass values like this using the
    "page.aspx?arg1=val1&arg2=val2" format, instead of "page.aspx?val1&val2".


    Steve C.
    MCSD,MCAD,MCSE,MCP+I,CNE,CNA,CCNA


    stephen wrote:
    > Hi all,
    >
    > I found a nice piece of code that helps me select a value from a datagrid
    > (second page) and pass the value to the calling page (first page)... but If
    > I need multiple values then the script fails, I am not good at scripting,
    > can someone please help me
    >
    > this is the code:
    >
    > <INPUT id=btnFind
    > onclick="document.getElementById('lbContractNum').innerHTML =
    > window.showModalDialog('FindContract.aspx?'+document.getElementById('lbContractNum').innerHTML,
    > '','width=300,height=300');"
    > type=button size=5 value=Find... name=findContract>
    >
    > How can pass parameters to get multiple values using the same click event
    > for eg:
    >
    > I want to try
    >
    > <INPUT id=btnFind
    > onclick="document.getElementById('lbContractNum').innerHTML =
    > window.showModalDialog('FindContract.aspx?'+document.getElementById('lbContractNum').innerHTML,
    > document.getElementById('lbContractName').innerHTML =
    > window.showModalDialog('FindContract.aspx?'+document.getElementById('lbContractName').innerHTML
    > '','width=300,height=300');"
    > type=button size=5 value=Find... name=findContract>
    >
    > I get script errors,
    >
    > thanks for your help,
    > Stephen
    >
    >
    Steve, Aug 27, 2007
    #2
    1. Advertising

  3. stephen

    stephen Guest

    Hi Steve,

    Thanks for the information but now I am getting new errors:
    I have used this code in the rowdatabound, how do i modify this to take 2
    values?

    protected void dgCustomer_RowDataBound(object sender, GridViewRowEventArgs
    e)
    {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
    LinkButton myLink = (LinkButton)e.Row.Cells[0].Controls[0];
    myLink.OnClientClick = "window.returnValue=" + e.Row.Cells[1].Text +
    ";window.close();return false;";

    }

    }
    I want to return e.row.cells[2].text
    I tried
    myLink.OnClientClick = "window.returnValue=" + e.Row.Cells[1].Text +
    "window.returnValue=" + e.Row.Cells[2].Text +
    ";window.close();return false;";


    Thanks,
    Stephen

    "Steve" <> wrote in message
    news:...
    >I would try it this way:
    >
    > <INPUT id=btnFind
    > onclick="document.getElementById('lbContractNum').innerHTML =
    > window.showModalDialog('FindContract.aspx?num='+document.getElementById('lbContractNum').innerHTML
    > + '&name=' + document.getElementById('lbContractName').innerHTML,
    > '','width=300,height=300');"
    > type=button size=5 value=Find... name=findContract>
    >
    > Basically, you want to separate the values you're passing with a "&"
    > character. Another thing, you normally pass values like this using the
    > "page.aspx?arg1=val1&arg2=val2" format, instead of "page.aspx?val1&val2".
    >
    >
    > Steve C.
    > MCSD,MCAD,MCSE,MCP+I,CNE,CNA,CCNA
    >
    >
    > stephen wrote:
    >> Hi all,
    >>
    >> I found a nice piece of code that helps me select a value from a datagrid
    >> (second page) and pass the value to the calling page (first page)... but
    >> If I need multiple values then the script fails, I am not good at
    >> scripting, can someone please help me
    >>
    >> this is the code:
    >>
    >> <INPUT id=btnFind
    >> onclick="document.getElementById('lbContractNum').innerHTML =
    >>
    >> window.showModalDialog('FindContract.aspx?'+document.getElementById('lbContractNum').innerHTML,
    >> '','width=300,height=300');"
    >> type=button size=5 value=Find... name=findContract>
    >>
    >> How can pass parameters to get multiple values using the same click event
    >> for eg:
    >>
    >> I want to try
    >>
    >> <INPUT id=btnFind
    >> onclick="document.getElementById('lbContractNum').innerHTML =
    >>
    >> window.showModalDialog('FindContract.aspx?'+document.getElementById('lbContractNum').innerHTML,
    >> document.getElementById('lbContractName').innerHTML =
    >>
    >> window.showModalDialog('FindContract.aspx?'+document.getElementById('lbContractName').innerHTML
    >> '','width=300,height=300');"
    >> type=button size=5 value=Find... name=findContract>
    >>
    >> I get script errors,
    >>
    >> thanks for your help,
    >> Stephen
    >>
    stephen, Aug 27, 2007
    #3
    1. Advertising

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. Eldon Ferran de Pol

    Client-side scripting from a radio button

    Eldon Ferran de Pol, Dec 15, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    2,066
    Munsifali Rashid
    Dec 15, 2003
  2. Dan Sikorsky
    Replies:
    0
    Views:
    440
    Dan Sikorsky
    Jun 2, 2005
  3. Ron Stephens
    Replies:
    23
    Views:
    2,771
    Ron Stephens
    Apr 12, 2004
  4. DaveInSidney
    Replies:
    0
    Views:
    391
    DaveInSidney
    May 9, 2005
  5. stephen

    scripting using Button

    stephen, Aug 27, 2007, in forum: ASP .Net
    Replies:
    6
    Views:
    410
    stephen
    Aug 29, 2007
Loading...

Share This Page