Changing Properties from Code
Our sample projects and report templates can help you learn the basics of working with our products.Find a form element by name, change its text and font in code, and send the updated form to the web component.
Finding the element. The form is loaded once and the required component is resolved by name, so the rest of the definition remains unchanged.
Updating its appearance. In
Finding the element. The form is loaded once and the required component is resolved by name, so the rest of the definition remains unchanged.
Updating its appearance. In
Changing Properties from Code/Controllers/FormsController.cs, the controller changes only the text and font properties before serializing the form for the browser:private StiForm ChangeFormProperties(StiForm form)
{
var labelCompanyName = form.GetElementByName("CompanyName") as StiLabelElement;
labelCompanyName.Text.Expression = "My Company";
labelCompanyName.Text.Font = new System.Drawing.Font("Arial", 20);
//Save-load form just for sample
var savedForm = form.SaveToString();
var loadedForm = new StiForm();
loadedForm.LoadFromString(savedForm);
return loadedForm;
}
}
}