Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: DataList with LinkButton Woes


Message #1 by "Shay E. Phillips" <sphillips@m...> on Mon, 22 Apr 2002 17:41:04
I want this code to show a label when the text is clicked. When I try to 
use the FAQSolutionLabel ID I get a complier error.

<%@ Page Language="C#" %>
<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Xml" %>
<HTML>
<HEAD>
<title>FAQ</title>
<script language="C#" runat="server">
void Page_Load(object source, EventArgs e)
{
string xmlFilename = @"Location of XML file";
int i=1;
DataSet newDataSet = new DataSet();
newDataSet.ReadXml(xmlFilename);
FAQDataList.DataSource = newDataSet;
FAQDataList.DataBind(); 
}
void FAQTitleClick(object source, EventArgs e)
{
//Unhide the label for this title...
//FAQSolutionLabel.visible = true
}
</script>
</HEAD>
<body topmargin="0" leftmargin="0">
<asp:Label ID="Message" Runat=server />
<form id="FAQ" runat="server">
<table width="750" cellspacing="0" cellpadding="0">
<tr>
<td style="height:20" bgcolor="#959595" cellspacing="0" cellpadding="0" 
width="100%" />
</tr>
<tr>
<td align="right" style="height:70;font-family:Arial,Helvetica;font-
weight:bold;font-size:44pt;color:white" width="100%" bgcolor="#e9e9e9">
<font size="6" color="#959595">AT Lab FAQ </font>
</td>
</tr>
<tr>
<td colspan="2">
<ASP:DataList id="FAQDataList" RepeatColumns="1" 
RepeatDirection="Horizontal" DataKeyField="Number" runat="server">
<ItemTemplate>
<div style="padding:15,15,15,15;font-size:10pt;font-family:Verdana">
<div style="font:10pt verdana;color:959595">
<i><b>
<asp:LinkButton ID=FAQTitleLabel Visible="true" OnClick="FAQTitleClick" 
runat=server Text='<%# DataBinder.Eval(Container.DataItem, "Title") %
>' /></i></b>
</div>
<br>
<asp:Label ID=FAQSolutionLabel Visible="false" runat=server Text='<%# 
DataBinder.Eval(Container.DataItem, "Solution") %>' /><p>
</div>
</ItemTemplate>
</ASP:DataList>
</td>
</tr>
<tr>
<td style="height:20" bgcolor="#959595" cellspacing="0" cellpadding="0" 
width="100%" />
</tr>
</table>
</form>
</body>
</HTML>

Any Ides would be great!

  Return to Index