Mega Code Archive

 
Categories / ASP.Net Tutorial / Data Binding
 

DisplayMode property

HyperLink:      Each list item is rendered as a link to another page. LinkButton:     Each list item is rendered by a LinkButton control. Text:           Each list item is rendered as plain text. <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server">     <title>Show BulletedList HyperLinks</title> </head> <body>     <form id="form1" runat="server">     <asp:BulletedList         id="blWebsites"         DisplayMode="HyperLink"         Target="_blank"         Runat="server">         <asp:ListItem             Text="Yahoo"             Value="http://www.Yahoo.com" />         <asp:ListItem             Text="Google"             Value="http://www.Google.com" />         <asp:ListItem             Text="asdf"             Value="http://www.asdfasdfasdf.com" />     </asp:BulletedList>     </form> </body> </html> File: Web.config <configuration>   <connectionStrings>     <add name="Products"           connectionString="Data Source=.\SQLEXPRESS;          AttachDbFilename=|DataDirectory|MyDatabase.mdf;Integrated Security=True;User Instance=True" />   </connectionStrings> </configuration>