views:

15

answers:

1

I want to populate an html label based on user information. I know how to read the data from html to c#, and how to manipulate the data. I just dont know how to return the data from c# to the html label.

<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="LoginUserName">Username:</asp:Label>
<asp:TextBox ID="LoginUserName" runat="server" CssClass="textEntry"></asp:TextBox>

<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="LoginPassword">Password:</asp:Label>
<asp:TextBox ID="LoginPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>

<asp:Label ID="errorMessageLable" AssociatedControlID="errorCheck" CssClass="errorMessage" runat="server"></asp:Label>

I want to be able to fill in the error message in the errorMessageLabel.

+1  A: 

In your code-behind file (the .cs file) you should access your label this way:

errorMessageLable.Text = "YourErrorMessageHere";
Leniel Macaferi