Hello,
I am using the following Listview:
And this function to group the data and create a "Header" which is actually a few cells at the beginning of each row of the table:
And what I'm trying to do is have this code put a cell at the end of each row of the table with the "Final Rating" in it....
I'm calling it in the asp code right before the end of the itemTemplate, so it is adding it after the first "JudgeRating" in the row, but I want it to wait and not display it until the last "JudgeRating" so it will actually be the last cell in the row. Is there something I can add to the VB code to make it wait until it binds the entire row, or is there somewhere else I should call it from in the asp code?
Thanks for your help!
...Josh
I am using the following Listview:
Code:
<asp:ListView ID="ListView1" runat="server" DataSourceID="sqlJudgeRatings">
<ItemTemplate>
<b><%#EntryInfoGroup()%> </b>
<td><font size="1px"><asp:Label ID="JudgeRatingLabel" runat="server"
Text='<%# Eval("JudgeRating") %>' /></font>
</td>
<%#AddFinalRating() %>
</ItemTemplate>
<LayoutTemplate>
<table runat="server" border="1">
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</div>
</LayoutTemplate>
</asp:ListView>
And this function to group the data and create a "Header" which is actually a few cells at the beginning of each row of the table:
Code:
Protected Function EntryInfoGroup() As String
'Get the data field value of interest for this row
Dim currentEntryName As String = Eval("EntryName").ToString()
Dim SchoolName As String = Eval("SchoolName").ToString()
Dim Directors As String = Eval("Directors").ToString()
Dim Classification As String = Eval("Classification").ToString()
Dim FinalRating As String = Eval("FinalRating").ToString()
If FinalRating.Length = 0 Then
FinalRating = "NotEntered"
End If
'See if there's been a change in EntryName
If lastEntryName <> currentEntryName Then
'There's been a change, Record change and emit the table row
lastEntryName = currentEntryName
Return String.Format("</tr><tr><td> {0} {1} <br />Directors: {2}</td><td> {3} </td><td>Final Rating:<br /><b> {4}</td><td> </td> ", SchoolName, currentEntryName, Directors, Classification, FinalRating)
Else
'no change, return an empty string
Return String.Empty
End If
End Function
And what I'm trying to do is have this code put a cell at the end of each row of the table with the "Final Rating" in it....
Code:
Protected Function AddFinalRating() As String
'Get the data field value of interest for this row
Dim currentEntryName2 As String = Eval("EntryName").ToString()
Dim FinalRating As String = Eval("FinalRating").ToString()
If FinalRating.Length = 0 Then
FinalRating = "NotEntered"
End If
'See if there's been a change in value
If lastEntryName2 <> currentEntryName2 Then
'There's been a change, Record change and emit the table row
lastEntryName2 = currentEntryName2
Return String.Format("<td>{0}</td>", FinalRating)
Else
'no change, return an empty string
Return String.Empty
End If
End Function
I'm calling it in the asp code right before the end of the itemTemplate, so it is adding it after the first "JudgeRating" in the row, but I want it to wait and not display it until the last "JudgeRating" so it will actually be the last cell in the row. Is there something I can add to the VB code to make it wait until it binds the entire row, or is there somewhere else I should call it from in the asp code?
Thanks for your help!
...Josh