开发者

How I can open a page in a new window and send data?

开发者 https://www.devze.com 2023-01-31 11:37 出处:网络
I\'ve been trying this for 2 days. In ASP.NET and VB.NET I\'ve page1.aspx and page2.aspx I would like when I press button1 in page1.aspx to trigger button1.click event and open a page2.aspx in a new

I've been trying this for 2 days.

In ASP.NET and VB.NET I've page1.aspx and page2.aspx

I would like when I press button1 in page1.aspx to trigger button1.click event and open a page2.aspx in a new window and send to it data.

All this can easly be done if no new window, by Server.Transfer or Response.Redirect.

But unfortunatly they don't have an option to open a new window.

Thanks,

Ahmed.

-- Updae --

I've used this solution but can't send the parameters and it opens me page 0 !!

    <asp:But开发者_开发问答ton ID="Add" runat="server" Text="Add" OnClientClick ="return pageOpen(TextBox1.SelectedValue, TextBox2.SelectedValue);"/> 

and the javascript is:

     <script type="text/javascript">
     function pageOpen()
    {
        window.open("page2.aspx?param1=" & arguments[0] & "&param2=" & arguments[1])
    }
</script> 


function openWindow() {
window.open('Page2.aspx?Arg1=' + document.getElementById('<%= txt1.ClientID %>').value + '&Arg2=' + document.getElementById('<%= txt2.ClientID %>').value, 'Title');
}


<asp:TextBox ID="txt1" runat="server" />
<asp:TextBox ID="txt2" runat="server" />
<asp:Button ID="btn" Text="Add" OnClientClick="openWindow()" runat="server" />

This should work...


You need to call window.open in Javascript with the data in the querystring.

0

精彩评论

暂无评论...
验证码 换一张
取 消