JRockFL
asked on
Programmatically set label value in web user control
I have a web user control customers.ascx that has one lablel lblFirstName.
I have default.aspx and I register that web user control.
How can I set the value of the label programmatically?
I have default.aspx and I register that web user control.
How can I set the value of the label programmatically?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
==========================
User Control
==========================
public partial class customers : System.Web.UI.UserControl
{
private static string _firstName;
protected void Page_Load(object sender, EventArgs e)
{
lblFirstName.Text = _firstName;
}
public void SetFirstName(string firstName)
{
_firstName = firstName;
}
}
==========================
ASP.NET Page
==========================
protected void Page_Load(object sender, EventArgs e)
{
customers cs = new customers();
cs.SetFirstName("Jason");
}