Dimi Dimi - 3 years ago 192
ASP.NET (C#) Question

Call method with enum parameter and Eval in ASP.NET

I have this method on page class

public string GetTranslations(UITranslations uiTranslation)
return ((AppUICulture)Application["UICulture"]).GetTranlsation(uiTranslation);

And I want to populate placeholder with string like

<input class="full-width has-padding has-border" id="inpLogId" type="text" placeholder='<%# GetTranslations( UITranslations.LOGIN_ID ) %>' required>

is an

How do I properly use
to get it done?

Answer Source

If you want to use Eval you need to create binding context. One of the easiest options would be to use FormView. Here is sample:

    <asp:FormView ID="FormView1" runat="server" DefaultMode="Insert">
            <input runat="server" class="full-width has-padding has-border" id="inpLogId" placeholder='<%# this.GetTranslations( UITranslations.LOGIN_ID) %>' />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download