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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

working with a hyperlink control in a dataset.

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
I have a dataset that contains a hyperlink control in the template. I need to add some code that opens a new window when clicked but changes the size. something like this

"window.open('pageyouwanttoopen.aspx', 'nameofwindow', 'toolbar=no,location=no,directories=no,menubar=no,resizable=yes, scrollbars=yes'); return false;");

I want to add it to this dataset but I don't know how.

<ASP:DataList id=&quot;MyDataList&quot; RepeatColumns=&quot;1&quot; runat=&quot;server&quot;>

<ItemTemplate>

<table cellpadding=10 style=&quot;font: 10pt verdana&quot;>
<tr>
<td width=75 class=&quot;apartmentwhite&quot;/>   <%# DataBinder.Eval(Container.DataItem, &quot;floorplanname&quot;) %>

<td valign=&quot;top&quot;>
<asp:HyperLink id=&quot;hyperlink1&quot;

ImageUrl='<%# DataBinder.Eval(Container.DataItem, &quot;ID&quot;, &quot;/images/floorplanpics/image-{0}.gif&quot;) %>'

NavigateUrl='<%# DataBinder.Eval(Container.DataItem, &quot;ID&quot;, &quot;enlarged.aspx?thepic=imageexpand-{0}.gif&quot;) %>'

Target=&quot;_new&quot;

runat=&quot;server&quot; /><br>Click floor plan for larger view.</td>

<td valign=&quot;top&quot;>

<b>Floor Plan: </b><%# DataBinder.Eval(Container.DataItem, &quot;floorplanname&quot;) %><br>
<b>Description: </b><%# DataBinder.Eval(Container.DataItem, &quot;description&quot;) %><br>
<b>Square Feet: </b><%# DataBinder.Eval(Container.DataItem, &quot;size&quot;) %><br>
<b>Price: </b><%# DataBinder.Eval(Container.DataItem, &quot;cost&quot;) %>

<p>
</td>
</tr>
</table>

</ItemTemplate>

</ASP:DataList>
 
Set up the window.open javascript code in a function. Then, call that function with the onclick or URL property of the hyperlink control.

function LinkWindow() {
&quot;window.open('pageyouwanttoopen.aspx', 'nameofwindow', 'toolbar=no,location=no,directories=no,menubar=no,resizable=yes, scrollbars=yes'); return false;&quot;);
}


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top