We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

MaskedEditTextBox Problem

hello good afternoon.

I have a problem with a type MaskedEditTextBox ItemTemplate.
I have this element in a ToolBar with other Componenet.
The problem is I can not get the value that is written in this
mask field. The same toolbar I have a normal textbox, this element
I get the value that is easily written as follows:

texto = ((TextBox)(Barra1.Controls[1].Controls[1].FindControl("txtBox1"))).Text;

But to find the value of MaskedEditTextBox always returns empty.

texto = ((Syncfusion.Web.UI.WebControls.Shared.MaskedEditTextBox)(Barra1.Controls[1].Controls[1].FindControl("txtMaskNumeric"))).Value;

As commentary, the Toolbar is a component that I created and use it in all my pages.

5 Replies

LK Lakxman Kumar C Syncfusion Team April 5, 2010 01:19 PM UTC

Hi Rodrigo,

Thank you for your interest in Syncfusion Products.

When the maskedit is inside the Toolbar as template, the ID will be generated on the fly. So, the maskedit can only be accessed by iterating the template list for the presence of the maskedit text box and its 'Text' property will give the text of the MaskEditTextbox. Please try this and let me know if any concerns.

Regards,
Lakxman Kumar C


RQ RODRIGO QUIJANO April 5, 2010 05:33 PM UTC

The property 'Text' also returns empty.


RQ RODRIGO QUIJANO April 5, 2010 06:39 PM UTC

Sorry. Misunderstood the first time. How do I scan the components of the toolbar?


RQ RODRIGO QUIJANO April 5, 2010 06:58 PM UTC

foreach (Control control in Barra1.Controls[1].Controls[1].Controls)
if (control is Syncfusion.Web.UI.WebControls.Shared.MaskedEditTextBox)
{
String fr=((Syncfusion.Web.UI.WebControls.Shared.MaskedEditTextBox)control).Text;
}



I find the component, but the property 'Text' me back empty. I have to scan or otherwise?


LK Lakxman Kumar C Syncfusion Team April 15, 2010 04:58 AM UTC

Hi Rodrigo,

Thank you for your update.

The MaskEditTextBox added as a template control can be accessed by calling the button click method at the MaskEditTextBox's onLoad and then casting the sender as MaskEditTextBox. From then the Text property of the template mask edit can be obtained using the 'Text' property. Kindly refer the code snippet below.

[C#]

protected void Button1_Click(object sender, EventArgs e)
{
if (sender.GetType().FullName != "System.Web.UI.WebControls.Button")
{
mymask = sender as MaskedEditTextBox;
}
Label1.Text = mymask.Text;
}


Kindly try the above code and please let me know if you have any other queries.

Regards,
Lakxman Kumar C

Loader.
Live Chat Icon For mobile
Up arrow icon