Display multiple new windows

Posted by Ricardo Deano on Stack Overflow See other posts from Stack Overflow or by Ricardo Deano
Published on 2010-05-14T12:01:08Z Indexed on 2010/05/14 12:04 UTC
Read the original article Hit count: 333

Filed under:
|
|
|

Afternoon all.

I have the following scenario:

I have a search page where by a client searches for a product from a drop down list, upon clicking a button, a gridview is produced display the spec.

What I would like is the functionality for the user to make their selection and a new window pops up with the spec.

So I have a simple code behind for the search page:

 protected void Button1_Click(object sender, EventArgs e)
        {
            Session["Product"] = DropDownList1.SelectedValue;

            string strScript = "window.open('GridViewPage.aspx', 'Key', 'height=500,width=800,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,titlebar=no');";

            ScriptManager.RegisterStartupScript(this, typeof(string), "", strScript, true);
        }

And a gridviewpage that presents the data based upon the session created in the search page:

 <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        DataSourceID="LinqDataSource1">
        <Columns>
            <asp:BoundField DataField="Product" HeaderText="MemberID" 
                SortExpression="MemberID" />
            <asp:BoundField DataField="Spec" HeaderText="Spec" 
                SortExpression="Spec" />

        </Columns>
    </asp:GridView>

    <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
        ContextTypeName="GridViewInNewWindow.ProductDataContext" EntityTypeName="" 
        TableName="tblProducts" Where="Product == @Product">
        <WhereParameters>
            <asp:SessionParameter Name="Product" SessionField="Product" 
                Type="String" />
        </WhereParameters>
    </asp:LinqDataSource>

Now upon first iteration, this does the job...gridview presented in new window...hurrah! i.e. a user searches for egg, the spec for an egg is presented in a new window.

However, what I would like to happen is that the user can make multiple searches so a number of new windows are opened. i.e. a user searches for egg once, the spec is returned in a new window; they then wish to see the spec for a chicken, so they use the search page to find said chicken, click the button and another new window is shown displaying the chicken's specs.

Does anyone know how I can achieve this? Apologies if this is simple stuff, I am just finding my feet.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript