Hello,
Does anyone know how to clear all inputs on a configurator page without having to type them all out and assign them a blank value?
Respectfully,
Utah
Hello,
Does anyone know how to clear all inputs on a configurator page without having to type them all out and assign them a blank value?
Respectfully,
Utah
You can use a foreach loop to go through all controls (a good naming convention is ideal for this) and clear them. Just curious, why would you want clear all on a Page leave?
Hi Dan,
It was just an example, we really want to do it on a button click.
How do you loop through all of the controls? Where do I get them.
Respectfully,
Utah
You can pick a control, grp01 in this example, and then iterate through all controls for the parent (page or form). You can then access various properties. You would most likely want to filter certain controls. The example below sets label values by using a PC Lookup table.
foreach (Control ctrl in Inputs.grp01.Control.Parent.Controls)
{
((InputControlValueBound<Ice.Lib.Framework.EpiLabel, String>)Inputs[ctrl.Name.ToString()].Value).Label = PCLookUp.DataColumnRange(LookupTableControlLabels, LookupTableControlColumn, (ctrl.Name.ToString(). Substring(14,3)), (ctrl.Name.ToString().Substring(14,3)));
}
This is the code I am using to clear text boxes. The text boxes are cleared however when the onclick expression finishes, all the values are repopulated. Nothing stayed clear.
foreach(Control ctrl in Inputs.cbDebug.Control.Parent.Controls) {
((Ice.Lib.Framework.EpiTextBox)ctrl).Value = “”;
}
}
Do something like this. I added the IF to avoid controls without a value property. You can use control type to find just text boxes.
foreach(Control ctrl in Inputs.epiPcTextBox1.Control.Parent.Controls)
{
if (ctrl.Name.ToString() == “epiPcTextBox2”)
{
((InputControlValueBound<Ice.Lib.Framework.EpiTextBox,String>)Inputs[ctrl.Name.ToString()].Value).Value = “Test”;
}
}
Awesome! That worked. Thanks,
Please don’t forget to mark the problem as solved to help your fellow members, and give credit where credit is due.
How do i mark it as resolved? I don’t see the ability.
Go to the answer you found and click the … Icon underneath ti and select the CheckBox to Mark that as the solution
Interesting. I don’t have a check box next to the trash can. I don’t have a wrench either.
Thanks everyone! @josecgomez @danbedwards
nevermind. It is not my question so i don’t have the option to except the solution.