In an ASPxPageControl i have added some labels and textboxs dynamically created. Initially the Text property of the text box is empty until the end user fills the text box according to the information necessary.
The next step is to press the Save Button and when this occurs, in the button_ClickEvent function I get all the controls correctly but the text property always is empty even though the user have filled in the text box
Am I missing something in my code?
Here's my code:
PropertyInfo cntrlProperty;
foreach (System.Web.UI.Control cntrl in pControl.TabPages[1].Controls)
{
Type ControlType = testAssembly.GetType(typeof(ASPxTextBox));
if (!cntrl.GetType().Equals(typeof(ASPxLabel)) && cntrl.GetType().Equals(ControlType))
{
cntrlProperty = cntrl.GetType().GetProperty("Text");
var value = cntrlProperty.GetValue(cntrl);
VALUES += String.Format("'{0}'" + ",", value);
}
}
Also I tried to set a default string when creating my controls dynamically and this woks fine because this default string is in the text box when the controls are rendered.
let's say the default string = "just a string";
Till this point in my code above the variable value = just a string and this is OK.
Then what I did was to append(I typed "in the textbox") some text to the "default string" in the runtime NOW default string looks like
default string = "just a string in the textbox"
and then I pressed Save Button and it turns out that the variable value it still stores value = just a string
Any idea why is this happenig?