please help me how to put the hyperlink control in the datalist control
please help me how to put the hyperlink control in the datalist control
to put hyperlink in datalist conrol, firstly click on the edit templates. then add hyperlink control within that. after that end the edit templates. Then goto source code and use databinder property. you will get the hyperlink vontrol and its link also.
hi.....
just refer this link you will get the answer easily.......
ASP.NET HyperLink Control
it will sure help you....
thanks....!!!
Following code will help you...
<%@ Import NameSpace="System.Data" %>
<html>
<head>
<title>Hungry Minds Chapter 9...</title>
<script language="C#" runat="server">
DataSet ds = new DataSet();
void Page_Load(Object sender, EventArgs e) {
ds.ReadXml(Page.MapPath("data.xml")) ;
BindData();
if (Request.QueryString["birthday"] != null ) msg.Text = "Your birthday is
in " + Request.QueryString["Birthday"];
}
void BindData() {
HyperLink.DataSource = ds;
HyperLink.DataBind();
}
</script>
</head>
<body>
<img src="logo.gif">
<br>
<font face="verdana" size="5">DataGrid Example with the HyperLink Column...</font>
<hr>
<form method="post" runat="server">
<aspataGrid
ID="HyperLink"
AutoGenerateColumns="false"
ShowHeader="True"
RunAt="server">
<HeaderStyle
BackColor="#6699cc" />
<columns>
<asp:HyperLinkColumn
DataNavigateUrlFormatString="HyperLinkColumn.ASPX? Birthday={0}"
DataNavigateUrlField="Birthday"
DataTextField="Name"
HeaderText="Name" />
</columns>
</aspataGrid>
<asp:Label ID="msg" Runat="server" />
</form>
<hr>
</body>
</html>
Bookmarks