Thursday, March 22, 2012

Masked Text Box

OK,

I feel really stupid here, but I cannot seem to activate the MaskedTextBox control in Visual Web Developer. When I select 'Show All' in the tool box I see an entry for it, but it is greyed out and cannot be draged onto the form, and when I deselect the 'Show All' it is not visible at all. When I click 'Choose Toolbox Items' the item 'MaskedTextBox' is checked under .Net Framework Controls, but I still can't use the control.

Please help, I need to be able to use this control for data validation.

Thanks.

Mike

The MaskedTextBox control is a windows forms control and is not for use in a web application.

The asp.net ajax control toolkit does offer a MaskedEdit control that might offer the functionality you need.

http://ajax.asp.net/ajaxtoolkit/MaskedEdit/MaskedEdit.aspx


You cannot use a Wondows control in a web application but you have several options such as the MaskEditExtender from the AjaxToolkit.

Hope I can Help


Thanks for your answers.

So maybe I need to figure out a different answer. My specific proble is that I have a text box that is being saved to SQL Server and when sombody puts a ' in the text box SQL server interprets it as a field deliminator and the whole app crashes. Any smart ideas on how to strip out non-allowable characters before saving to SQL?

Thanks again.

Mike


when you use sqlparameters for your values, then you do not need to worry about any special characters such as a single quote that might be contained in the data. This would also protect you from sql injection attacks.

for example:http://www.uberasp.net/getarticle.aspx?id=46


Thanks. This will be a bunch of work but should clean up the overall application.

Mike

0 comments:

Post a Comment