Dynamically modifying an ASP Repeater Control column?

BlakeMcKenna

Active member
Joined
Oct 27, 2008
Messages
38
Programming Experience
10+
I have an asp:repeater control on a form. It contains 4 columns. Based on a certain value as a result of a database read, the 4th column, needs to contain a button control else it will contain plain text. How do I this in the code-behind using VB.Net? The code that I have is below but it's not working. I've never worked with a repeater control before.

Thanks,

VB.NET:
<asp:repeater id="dlAppeal" runat="server">
	<HeaderTemplate>
		<tr id="AppealHeader" runat="server">
			<td class="tableHeaderNw" align="center" width="11%">Date</td>
			<td class="tableHeaderNw" align="center" width="16%">Type</td>
			<td class="tableHeaderNw" align="center" width="53%">Description</td>
			<td class="tableHeaderNw" align="center" width="20%">Appellant</td>
		</tr>
	</HeaderTemplate>
	<ItemTemplate>
		<tr>
			<td align="left" width="11%" class="citDataBlack">
				<%# DataBinder.Eval(Container.DataItem, "D_TransDt") %>
			</td>
			<td align="left" width="16%" class="citDataBlack">
				<%# DataBinder.Eval(Container.DataItem, "D_TransDesc") %>
			</td>
			<td align="left" width="53%" class="citDataBlack">
				<%# DataBinder.Eval(Container.DataItem, "D_Explanation") %>
			</td>
			<td align="left" width="20%" class="citDataBlack">
				<%# DataBinder.Eval(Container.DataItem, "D_Appelant") %>
			</td>		
                </tr>
	</ItemTemplate>
</asp:repeater>

VB.NET:
                If appelant <> "" Then
                    RSAppeal("D_appelant") = appelant
                Else
                    If RSAppeal("TransCode") = 108 Then
                        Dim btn As New System.Web.UI.WebControls.Button

                        btn.Text = "Print Appeal Letter"
                        dlAppeal.Controls.Add(btn)
                        btn.Visible = True
                        RSAppeal("D_appelant") = btn
                    End If
                End If
 
Back
Top