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

Another Datalist question!

Status
Not open for further replies.

oddball

Technical User
Mar 17, 2000
64
GB
I want to display a size restricted window with no menu bar from a Hyperlink control in a Datalist. The URL needs to also pass the CompanyID.

The only way i know to open a mini window is using Javascript, so I am trying to combine the call to the Javascript function with the Databinder of the CompanyID. The end URL should look like this:

admin/Homepage.aspx?companyid=1

Here's the code:
===========================================================

<asp:DataList id=&quot;myDataList&quot; CellPadding=&quot;4&quot; Width=&quot;98%&quot; EnableViewState=&quot;false&quot; runat=&quot;server&quot;>
<ItemTemplate>
<span class=&quot;ItemTitle&quot;>
<asp:HyperLink NavigateUrl=&quot;javascript:eek:penWindowScroll('admin/Homepage.aspx?companyid=')&quot; Text=<%# DataBinder.Eval(Container.DataItem,&quot;CompanyName&quot;) %> runat=&quot;server&quot; />
</span>
<br>
<span class=&quot;Normal&quot;>
Joined <%# DataBinder.Eval(Container.DataItem,&quot;RegDate&quot;) %>  
</span>
<br>
</ItemTemplate>
</asp:DataList>

===========================================================

Here's what i want to crowbar into it:
===========================================================


<%# DataBinder.Eval(Container.DataItem,&quot;CompanyID&quot;) %>


===========================================================

Setting the NavigateURL to the Javascript on its own works, as does the DataBinder on its own, but i can't combine them without a syntax error. Is it possible or have i got the wrong approach?

cheers in advance,

si
 
try this approach:

<span class=&quot;ItemTitle&quot;>
<a href=&quot;javascript:eek:penWindowScroll('admin/Hompage.aspx?companyid='<%# DataBinder.Eval(Container.DataItem(&quot;companyID&quot;)) %>');&quot;>
<%# DataBinder.Eval(Container.DataItem,&quot;CompanyName&quot;) %>
</a>
</span>

or better yet, if it were me, I'd put all but the companyID into the javascript function, and just pass in the id as an argument to the function. That's w/o knowing what else you use it for, though, so that might not be feasable.

anyway... hth :)
paul
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top