Setting item template properties via ItemDataBound event

Finding and setting a controls properties during the ItemDataBound event of the Repeater control. Within a repeater control I had to find a hyperlink control and set some of its properties. This allowed me to use a data source to provide the information to the repeater control and then set the properties of any control as required.
Protected Sub rptTemplates_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptTemplates.ItemDataBound

        Dim lhypLink As HyperLink = e.Item.FindControl("hypLink")
        lhypLink.NavigateUrl = "ThisIsAutomaticallySet.html"
        lhypLink.Text = "Some text"

End Sub

0 comments: