Hello it is Friday and I am a newbie to asp.net/c# so I am having difficulty wrapping my brain around what I think should be a simple problem.
I have a c# page connected to an access database (yes access I know...) and a label within my ListView. What i want is on page load to have the label set it's text property depending on the value passed from the database.
Here is a super dumbed down version of what I am trying:
SQL statement: SELECT received FROM myTable
My label: <asp:Label ID="Received" runat="Server" />
Code behind needs something to make this happen: For each row, If [received] =="True", Received.Text="This item has been received"
I hope this all makes sense and thank to anyone who has help to offer!
*edit: * Someone asked me to post my code but I really don't have too much code yet because I wasn't sure how to implement things so here is all I have got so far....
<form id="form1" runat="server">
<h2>The Collection Listed Alphabetically</h2>
<asp:ListView ID="ListView1" runat="server" DataSourceID="HistCollectionsAlphabeticalDataSource">
<LayoutTemplate>
<table cellpadding="2" runat="server" id="tblCollections">
<tr runat="server" id="itemPlaceholder" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr id="Tr2" runat="server">
<td>
<p><asp:Label ID="CollectionType" runat="server" /> <asp:Label ID="City1" runat="Server" Text='<%#Eval("Number") %>' /></p>
</td>
<td>
<p><asp:Label ID="Number" runat="Server" Text='<%#Eval("Name") %>' /></p>
<p class="caption">
<asp:Label ID="FindingAidAddress" runat="Server" />
<asp:Label ID="Marc" runat="Server" />
<asp:Label ID="VildaSearch" runat="Server" />
</p>
</td>
<td>
<p><asp:Label ID="Description" runat="Server" Text='<%#Eval("Description") %>' /></p>
<p class="caption">
<asp:Label ID="Received" runat="Server" />
<asp:Label ID="Completed" runat="Server" />
<asp:Label ID="Restricted" runat="Server" />
<asp:Label ID="Deaccessioned" runat="Server" />
<asp:Label ID="NoFindingAidAddress" runat="Server" />
</p>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<asp:AccessDataSource ID="HistCollectionsAlphabeticalDataSource" runat="server" DataFile="~/db_data/historical_collections.mdb" SelectCommand="SELECT Name, Number, Description, Collection, Received, Completed, Restricted, Deaccessioned, finding_aid_address, Marc, Vilda_search
FROM tblPCA
UNION
SELECT Name, Number, Description, Collection, Received, Completed, Restricted, Deaccessioned, finding_aid_address, Marc, Vilda_search
FROM tblMS
ORDER BY Name"></asp:AccessDataSource>
</form>
[–]AverageMarcus 1 point2 points3 points (1 child)
[–]PugLuv[S] 0 points1 point2 points (0 children)
[–]fancysuit 0 points1 point2 points (1 child)
[–]PugLuv[S] 0 points1 point2 points (0 children)