?
Solved

how to use href in Datalist control to use window.open(), without any post back

Posted on 2007-08-08
2
Medium Priority
?
763 Views
Last Modified: 2013-11-05
Hello,
i want to display some users in a DataList control in such a way that the users should be like a link and upon click there should be a window.open, there should be no post back.

how to do that, i mean how to assign values to the <a href="?"></a>

thanks
0
Comment
Question by:apnamian
2 Comments
 
LVL 30

Expert Comment

by:third
ID: 19652964
use this,

<a href="#" onclick="newwin = window.open('username.html','newwin','width=300,height=100');return false;">username</a>
0
 
LVL 15

Accepted Solution

by:
VincentPuglia earned 1500 total points
ID: 19655400
Hi,

  I'm not an Asper, but you might try something like the following:


<ItemTemplate>
<a href="#" onclick="newwin = window.open('<%#Container.DataItem("userURL")%>','newwin','width=300,height=100');return false;"><%#Container.DataItem("userName")%></a>
</ItemTemplate>

The above presumes your xml page has 2 datasets: userURL & userName.   You may have to fiddle with the quotes and/or possibly add "&" between the html & the asp.

You also might want to consider using the repeater control rather than the dataset constrol, since the latter uutomatically encloses the items within a table and the former leaves you the option of using <ul>s.

Finally, here are two links from W3school:

datalist:  http://www.w3schools.com/aspnet/aspnet_datalist.asp
repeater:  http://www.w3schools.com/aspnet/aspnet_repeater.asp
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question