10-21-2009 01:20 PM
I want to change the label text based on a fileld value(not the main entity in the form). How do I do that? Can I color this label?
public static void OnLoadAccountDetailStep( IAccountDetails form, EventArgs args, out object result)
// TODO: Complete business rule implementation
IRepository<IEsiSofcm> rep = EntityFactory.GetRepository<IEsiSofcm>();
IQueryable qry = (IQueryable)rep;
IExpressionFactory ef = qry.GetExpressionFactory();
ICriteria criteria = qry.CreateCriteria();criteria.Add(ef.Eq("CUSTOMER_ID", "ASCLEP2"));
result = criteria.List<IEsiSofcm>();
form.lblCreditHold.Text = "TEST";
//what I want is
form.lblCreditHold.Text = result.Customer_Status;
10-22-2009 08:45 AM
Your variable 'result' is of type object, you have to cast it first to the datatype you are returning from you query in order to access its properties.
Something like this (be aware that it will work if you return a unique element) however in your code you are returning a list so you will have to select the item in the list that you whant to use the value from:
form.lblCreditHold.Text = ((IEsiSofcm)result).Customer_Status;
And yes regarding your second question you can change the properties of the label using its NativeControl
System.Web.Controls.Label customLabel = (System.Web.Controls.Label)form.lblCreditHold.NativeControl
this way you can access all label properties.