PopUp New Window in List Control with Multiple Parameters

Just saw 2 very similar post in the ASP.NET Forums yesterday (It would probably be a FAQ about using Javascript and DataGrid)

- NavigateURL Javascript

- opening a new window from inside a DataGrid

 

My suggestion solution is like that:

PopUp New Window in List Control with Multiple Parameters

<asp:TemplateColumn>
    <ItemTemplate>
        <asp:HyperlInk
                ID="HyperLink1"
                Runat="Server"
                NavigateUrl='<%# "Javascript:var PopUpWin = window.open(""WebForm2.aspx?Param1=" & DataBinder.Eval(Container.DataItem,"Field1") & "&Param2=" & DataBinder.Eval(Container.DataItem, "Field2") & """)" %> '
        >
            <%# Container.DataItem("TextField") %>
        </asp:HyperLink>
    </ItemTemplate>
</asp:TemplateColumn>

Colt

P.S. the approach above would avoid the problem of showing the screen of [Object] on the parent page.

Published Wednesday, April 30, 2003 3:31 PM by Colt
Filed under:

Comments

# re: PopUp New Window in List Control with Multiple Parameters

Thanks for the nice article. But I am having some probs in my page(C#).Plz help.

Compiler Error Message: CS1026: ) expected

Source Error:

Line 156: <%# DataBinder.Eval(Container.DataItem, "vPhone") %>
Line 157: </b></font> </TD>
Line 158: <TD width="14%" rowspan="3" align="left" bgColor="#CCCCCF">&nbsp; <asp:hyperlink BackColor="#666666" BorderColor="#000000" CssClass="lnkCompanyInfo" Font-Name="verdana" Font-Size="8" ForeColor="#FFFFFF" ID="lnkCompanyInfo" NavigateUrl='<%# "Javascript:var PopUpWin = window.open(""company_info.aspx?vID=" & DataBinder.Eval(Container.DataItem,"vID") & "&vID=" & DataBinder.Eval(Container.DataItem, "vID") & """)" %>' runat="server" Text="Details" ToolTip="View Details"></asp:hyperlink>

Thursday, June 26, 2003 10:32 PM by Sougata

# re: PopUp New Window in List Control with Multiple Parameters

I have same problems. Please help!!

Compiler Error Message: CS1010: ) expected

<asp:TemplateColumn HeaderText="Test">
line 96: <ItemTemplate>
line 97: <asp:HyperLink id=Hyperlink4 Text='<%# Container.DataItem("base_code") %>' NavigateUrl='<%# "Javascript:var PopUpWin=window.open(""pop_grade_info.aspx?base_code=" &amp; DataBinder.Eval(Container.DataItem,"base_code") &amp; "&amp;grade_code=" &amp; DataBinder.Eval(Container.DataItem, "grade_code" &amp; """)" %>' Runat="Server">
line 98: </asp:HyperLink>
line 99: </ItemTemplate>

Wednesday, July 02, 2003 3:51 PM by Park

# re: PopUp New Window in List Control with Multiple Parameters

Try it as
<ItemTemplate>
<asp:Hyperlink
ID="Hyperlink2"
Runat="Server"
NavigateUrl= <%#"javascript:my_window=window.open('webform2.aspx?orderid=" + DataBinder.Eval(Container.DataItem,"OrderID").ToString() + "&Productid=" + DataBinder.Eval(Container.DataItem,"ProductID").ToString() + "','my_window','width=300,height=300');my_window.focus()" %>
text=<%#DataBinder.Eval(Container.DataItem,"OrderID").ToString() %>>
</asp:Hyperlink>
</ItemTemplate>


Regards
Sushila
.NET MVP

Monday, August 04, 2003 3:00 PM by Sushila Bowalekar Patel

# re: PopUp New Window in List Control with Multiple Parameters

how do we get rid of the [object] issue?

regards

Friday, August 08, 2003 1:37 AM by Shalin Jain

# re: PopUp New Window in List Control with Multiple Parameters

I'm trying to implement it for a datagrid.

Friday, August 08, 2003 1:43 AM by Shalin Jain

# re: PopUp New Window in List Control with Multiple Parameters

Hi Shalin,

You can put a var PopUpWin = window.open(...) for the 'PopUp' of new window in order eliminiate the problem of seeing [object] problem.

FYI:
- The a tag
- open Method
- Using a Pop-Up Calendar and a List Control
- PopUp Calendar

Friday, August 08, 2003 4:34 AM by Colt

# re: PopUp New Window in List Control with Multiple Parameters

hii colt
im still having the same problem ...wht shld i do now

Friday, August 08, 2003 2:11 PM by shalin Jain

# re: PopUp New Window in List Control with Multiple Parameters

can we use a template column in a datagrid

Friday, August 08, 2003 2:17 PM by shalin jain

# re: PopUp New Window in List Control with Multiple Parameters

Hi Shalin,

I'd suggest you go and post your code/question to the Forums for further discussion.

Friday, August 08, 2003 9:19 PM by Colt

# re: PopUp New Window in List Control with Multiple Parameters

BTW Shalin, you may take a look at this thread for reference.
http://asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=302946

Saturday, August 09, 2003 12:43 PM by Colt

# re: PopUp New Window in List Control with Multiple Parameters

thanx a lot colt i got the problem solved its working perfectly

Sunday, August 10, 2003 2:58 AM by shalin

# re: PopUp New Window in List Control with Multiple Parameters

My solution

<ItemTemplate>
<asp:HyperLink id="lnkOcchio" runat="server" NavigateUrl='<%# "javascript:var PopUpWin = window.open(\u0027VediScheda.aspx?IDArticolo=" + DataBinder.Eval(Container.DataItem,"IDArticolo") + "\u0027,\u0027VediScheda\u0027,\u0027width=540,height=400,scrollbars=1,menubar=0,resizable=0,toolbar=0\u0027)" %>' >
<img src="Immagini/Occhio.gif" border="0">
</asp:HyperLink>
</ItemTemplate>

Friday, November 14, 2003 4:02 AM by Regent

# re: PopUp New Window in List Control with Multiple Parameters

SO GOOD!
It help me out of puzzle!
Thanks a lot!

??!
????????!

Wednesday, July 21, 2004 8:04 AM by Jeff Zheng

# re: PopUp New Window in List Control with Multiple Parameters

Thanks! I found similar answers in other forums, but it didn't work -- your's did :)

Tuesday, November 03, 2009 3:06 PM by Mike

Leave a Comment

(required) 
(required) 
(optional)
(required)