.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Databound Hyperlinks in ListView. Need to open external sites

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :ASP.Net

Good Evening,

This site is ASP.NET 4.0 connected to a SQL 2005 backend.  The database has a table that, among other things, lists the names and URIs of external sites for reference purposes.  A webform has a ListView control bound to an ObjectDataSource that pulls the data from this table.  The ItemTemplate and the AlternatingItemTemplate have been edited so that they contain this HyperLink:

                            Text="Route Map" 
                            NavigateUrl='<%# Eval("Maplink") %>' />

The page renders the data normally but the HyperLinks aren't working as intended.  For example, the datatable record might contain
But when the HyperLink is created in the ListView, it comes out as:
which, of course, fails.

How can I set up the HyperLink to route to the external site and ignore the local domain path?

Thanks for any suggestions. 


View Complete Post

More Related Resource Links

Hyperlinks in Sharepoint do not open the correct document?

I have an access db that has a field for a hyperlink. I uploaded the table to Sharepoint and found that the field shows the correct path to the document, but will open a totally different document. I desperately need help and have limited experience with Sharepoint.

open pdf in new window for Listview webpart



I'm working with XSLT Listview webpart.Webpart has got multiple documents like PDFs,word docs and Images.my requirement is when the user clicks on PDF it has to be opened in new window.

I treid using javascript by looping all the links in the page,if the document has .pdf extension am setting target to '_blank' ,didn't work out....

Note:Am using out of the box web part.


Thanks in advance.








ListView DataBound


I am using ListView to display the Data.


I am getting some text or empty string from backend for a particular colummn.

If i got empty string i need to bind with an imageButton in that row.

and if i got a text i need to replace the imagebutton with text.

protected void lv_DataBound(object sender, EventArgs e)






Thanks in Advance.

pageviewer webpart to downscale external sites ?


Hi there,

I am looking for a webpart that has similar functionality like the pageviewer webpart, but that can render external websites and even downscale/downsize them to be completely visible in smaller sizes (e.g. in a webpart zone of a webpage).

Does anyone know any good 3rd party webpart or something opensource?




pageviewer webpart to render and display external sites in different resolution ?


Hi there,

I am looking for a webpart that has similar functionality like the pageviewer webpart, but that can render external websites and even downscale/downsize them to be completely visible in smaller sizes (e.g. in a webpart zone of a webpage).

Does anyone know any good 3rd party webpart or something opensource?



trying to select non-existent node in listview databound event icw xmldatasource


Protected Sub repLocationsToCompare_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) Handles repLocationsToCompare.ItemDataBound

Dim enumerable As IEnumerable = System.Web.UI.XPathBinder.Select(e.Item.DataItem, "./str[@name=""thumb""]")

Now, it might be that the current dataitem does NOT contain the <str name="thumb"></str> node. So in that case when I do this:
Dim name As String = enumerable.Cast(Of XmlElement)().Select(Function(x) x.Attributes("name")).FirstOrDefault().Value
the enumerable throws an error of object reference not set to instance of object.

I tried testing it like this:
Dim enumerable As IEnumerable = System.Web.UI.XPathBinder.Select(e.Item.DataItem, "./str[@name=""thumb""]")
if enumerable isnot nothing then
Dim name As String = enumerable.Cast(Of XmlElement)().Select(Function(x) x.Attributes("name")).FirstOrDefault().Value
end if

But still I get the error.

How can I test if the node exists for the current dataitem?

can't open the list that created from external content types


Hi all,

  I created a external content types file from SQL DB (Northwind), the table is order details, original I created "all operations" then post to list. but when I go back the web site to open this list, I got error message like this :

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.

Correlation ID:00d1bb01-90b6-4bde-992d-9368199cad64

  so I think maybe this table belong to detail and table include 2 field for primary key, so I delete and re-created to readitem & Readlist then post to web site again.

but I got same error again. does anybody can help me to resolved this issue ?

ps. I used same DB to created order, product and post to Web site, it's working correct.



SharePoint Tutorial - Team Sites

Team sites are small web sites that are created to store everything about a particular thing. For example a site can be created for a department in an organization like human resources. I site can be created for a particular project. A site can even be created for a meeting. Everything about the thing (department, project, meeting) like documents, lists, calendars, etc. is stored in that site.

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

How To Open Fancy Tooltip from GridView

This article will show How To Open show Fancy Tooltip in GridView.

Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).

WPF Tutorial - Using The ListView, Part 1

Many of the controls in WPF have a downright dizzying array of capabilities and features, due in large part to the composibility of all the components. The ListView control is a great example of this - the possibilities are almost endless. This series of tutorials on the ListView will hopefully make the space of possible options seem not quite as daunting

How to listen to events within a listview



I've got a listview and I've put a button control in one of the columns, I'm trying to figure out how I have listen to the button click within a certain row, but can't see the button in the dropdown for the IDs I can generate events for.

I'd like to get the primary key of the row that's been clicked on and then run a sql statement against it.

Any help would be appreciated.

ListView DataPager with SQL-Statements that already return only paged data.



As far as I understand the ListView-Control and the DataPager-Control, they work like this: The ListView gets its datarows from its data source, then the DataPager causes the ListView to display only a subset of those rows.

So what, when I want to use custom databinding for the ListView, that *already* gets the certain subset from SQL-Server (for better performance). Can I and how can I use the DataPager then?

Thanx, S.

Open ModalPopup dialog on page load


Is there a way to make a modal popup panel active on page load so that the user can't do anything until they deal with the popup dialog?

2 Web Sites


Does anyone know if it is possible to pass a Session variable from one web site, to another web site?  I am writing both.  They are located on the same server - but with different URL's... different projects... 

Open PopUp Window From Error httpModule


I would like to open a popup window from the assembly to present the information to the user. Does anyone know if this is possible, I am presently doing the following:

        WriteLine("body {font-family:""Verdana"";font-weight:normal;font-size: .7em;color:black; background-color:white;}")
        WriteLine("b {font-family:""Verdana"";font-weight:bold;color:black;margin-top: -5px}")
        WriteLine("H1 { font-family:""Verdana"";font-weight:normal;font-size:18pt;color:red }")
        WriteLine("H2 { font-family:""Verdana"";font-weight:normal;font-size:14pt;color:maroon }")
        WriteLine("pre {font-family:""Lucida Console"";font-size: .9em}")
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend