A
adiel_g
Hello Everyone, I created a custom control. On the
CreateChildControls, I added a textbox to the control as follows:
// TextBox
TextBox txtValue = new TextBox();
txtValue.ID = "txtValue";
protected override void CreateChildControls()
{
// Add the control to the form
Controls.Add(txtValue);
}
Now during postback, I am trying to access the value of the control:
// Property inside custom control that is being called from the
webform
public bool isValidMatch()
{
if (txtValue.Text == "test")
{
return true;
}
else
{
return false;
}
}
The isValidMatch method is being called from the webform during
postback. However the value of the textbox is blank no matter what
the user enters in the webform. I must be missing something in the
postback logic configuration of custom controls but cannot figure out
what the problem is and why is the textbox value always blank.
Thanks Before Hand,
Adiel
CreateChildControls, I added a textbox to the control as follows:
// TextBox
TextBox txtValue = new TextBox();
txtValue.ID = "txtValue";
protected override void CreateChildControls()
{
// Add the control to the form
Controls.Add(txtValue);
}
Now during postback, I am trying to access the value of the control:
// Property inside custom control that is being called from the
webform
public bool isValidMatch()
{
if (txtValue.Text == "test")
{
return true;
}
else
{
return false;
}
}
The isValidMatch method is being called from the webform during
postback. However the value of the textbox is blank no matter what
the user enters in the webform. I must be missing something in the
postback logic configuration of custom controls but cannot figure out
what the problem is and why is the textbox value always blank.
Thanks Before Hand,
Adiel