Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to open NEW window using Datalist control (with hyperlink) menu

Status
Not open for further replies.

mb224

Programmer
Oct 15, 2004
55
US
I am using a Datalist control as a Menu ..with choices of DeparmentID to select from .... using the ASP Hyperlink control.

It works great! ... However when a Department link is clicked I want it to open a NEW window instead of replacing the current window ... Am I using the right control i.e. the Hyperlink?

Also I want to implement something like this javascript so that the SAME 2nd window is opened regardless of the DepartmentID selection that is made.

Dim strClientCall As String

strClientCall = "<script language=javascript> "
strClientCall &= "var winQExp= window.open(" & "'default2.aspx?DepartmentID=????'" & ");"
strClientCall &= "winQExp.focus();"
'strClientCall &= " window.open(" & "'WebFrmQExplorer.aspx?'" & ")"

strClientCall &= "</script>"

Response.Write(strClientCall)

'here is the Datalist .....

<asp:DataList id="list" runat="server" CellPadding="0">
<HeaderTemplate>
<IMG alt="" src="Images/DeptHeader.gif" border="0">
</HeaderTemplate>
<SelectedItemTemplate>
&nbsp;&raquo;
<asp:HyperLink id="HyperLink2" runat="server" NavigateUrl='<%# "../default.aspx?DepartmentID=" &amp; DataBinder.Eval(Container.DataItem, "departmentID") &amp; "&amp;DepartmentIndex=" &amp; Container.ItemIndex %>' Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' CssClass="DepartmentSelected">
</asp:HyperLink>
</SelectedItemTemplate>
<FooterTemplate>
<IMG alt="" src="Images/DeptFooter.gif" border="0">
</FooterTemplate>
<ItemStyle BackColor="Yellow"></ItemStyle>
<ItemTemplate>
&nbsp;&raquo;
<asp:HyperLink id="HyperLink1" runat="server" NavigateUrl='<%# "../default.aspx?DepartmentID=" &amp; DataBinder.Eval(Container.DataItem, "departmentID") &amp; "&amp;DepartmentIndex=" &amp; Container.ItemIndex %>' Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' CssClass="DepartmentUnselected">
</asp:HyperLink>
</ItemTemplate>
<HeaderStyle BackColor="Yellow"></HeaderStyle>
</asp:DataList>


... any help?
 
OK .. I set the Target=_blank on the hyperlink control in the Datalist control ... so it now opens a NEW window.

However it is opening a another new window each time I make a DepartmentID selection ..... How can I make it REPLACE the 2nd window ..each time, so I do not have too many windows open all over the place?

How can I create a Window Handle .. with a Name like say 'SecondWindow' ..so that I can set my TARGET='SecondWindow' ?


<asp:DataList id="list" runat="server" CellPadding="0">
<HeaderTemplate>
<IMG alt="" src="Images/DeptHeader.gif" border="0">
</HeaderTemplate>
<SelectedItemTemplate>
&nbsp;&raquo;
<asp:HyperLink id="HyperLink2" runat="server" Target=_blank NavigateUrl='<%# " &amp; DataBinder.Eval(Container.DataItem, "departmentID") &amp; "&amp;DepartmentIndex=" &amp; Container.ItemIndex %>' Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' CssClass="DepartmentSelected">
</asp:HyperLink>
</SelectedItemTemplate>
<FooterTemplate>
<IMG alt="" src="Images/DeptFooter.gif" border="0">
</FooterTemplate>
<ItemStyle BackColor="Yellow"></ItemStyle>
<ItemTemplate>
&nbsp;&raquo;
<asp:HyperLink id="HyperLink1" runat="server" Target=_blank NavigateUrl='<%# " &amp; DataBinder.Eval(Container.DataItem, "departmentID") &amp; "&amp;DepartmentIndex=" &amp; Container.ItemIndex %>' Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' CssClass="DepartmentUnselected">
</asp:HyperLink>
</ItemTemplate>
<HeaderStyle BackColor="Yellow"></HeaderStyle>
</asp:DataList>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top