Let me try to explain my situation. I have a database table which contains, among other things, a boolean column called PermissionSlipRequired. I have a repeater on my page, and before each row in the database is shown in the repeater, I want to use my code behind to check the value of PermissionSlipRequired. Based on whether the value of PermissionSlipRequired is true or false, I want to change the text of a literal within the repeater. That's a real mouthful, hopefully some markup and code will clarify. Here's my repeater:

<asp:Repeater ID="PermissionSlipRepeater" runat="server" 
            <ItemTemplate><p class="ModuleContent"><span class="InlineTitle"><%# Eval("Title")%></span><br />
                <asp:Literal ID="PermissionSlipLiteral" runat="server"></asp:Literal></p>

Edited by happygeek: fixed formatting

7 Years
Discussion Span
Last Post by dnanetwork

on ItemDataBound Event you can change wotever you want...!

Not exactly sure what dnanetwork means ... anyway, here's the code I managed to come up with to do what I wanted:

Protected Sub PermissionSlipRepeater_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles PermissionSlipRepeater.ItemDataBound
        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
            Dim PermissionSlipLiteral As Literal = e.Item.FindControl("PermissionSlipLiteral")
            Dim CurrentRowDataRowView As System.Data.DataRowView = e.Item.DataItem

            If CurrentRowDataRowView.Row("PermissionSlipRequired") = True Then
                PermissionSlipLiteral.Text = "Permission slip required"

            End If
        End If
    End Sub

that's wot i've suggested...and that's wot u have done..

this is a common technique of solving this problem.

there is one more..find it if you can.. :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.