I'm new to ASP and was hoping to get some guidance on how to make my literal accessible in my Code Behind and then change it to the text of a passed in parameter.
I have an resources.ascx file that displays a list of people (pulled from a database). That is working fine and it looks something like this:
Full name
T: (888-888-8888)
F: (888-888-8888)
The problem, however, is that I now want it conditionally say "Toll Free" instead of "F:" for one page.
In the people.aspx page, I'm passing in "Toll Free" to the resource:
<%@ Register Src="~/UserControls/resources.ascx" TagName="Resources" TagPrefix="ucResources" %> <ucResources:Resources ID="Resources1" FaxNumberAlias="Toll Free" runat="server" /> resources.ascx The repeater outputs all the people from the database to the page.
<asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <div class="sectioncontent"> <b><%#Eval("EmployeeFirstName")%> <%#Eval("EmployeeLastName)%></b> T: <%#Eval("Phone")%> <br> <asp:Literal runat="server" ID="FaxNumberLabel">F:</asp:Literal> <%#Eval("Fax")%><br> </div> <br /> </ItemTemplate> In the resources.ascx.vb file, I wanna do something like this but FaxNumberLabel (the literal I declared in resources.ascx) isn't accessible or hasn't been declared.
Public Property FaxNumberAlias() As String Get Return _FaxNumberAlias End Get Set(ByVal value As String) _FaxNumberAlias = value End Set End Property Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not String.IsNullOrEmpty(_FaxNumberAlias) Then FaxNumberLabel.Text = _FaxNumberAlias End If PopulateRepeater() End Sub What am I missing that connects the literal to the code behind?