MargusLehiste
asked on
How to create PhoneBox custom control ?
What i want my custom control to look like this:
(<textboxW3no>) <textbox3no> - <textbox4no>
also - it should validate the numbers and when you have typed necessary amount of number - automatically refocus on the next textbox.
Im sure some of you people out there have already done it - so where could i find code for custom control like this?
(<textboxW3no>) <textbox3no> - <textbox4no>
also - it should validate the numbers and when you have typed necessary amount of number - automatically refocus on the next textbox.
Im sure some of you people out there have already done it - so where could i find code for custom control like this?
ASKER
Yes that is exactly correct (and in this custom control should be three textboxes).
I saw your post about SSN box - but I wasnt quite sure how would i accomplish it in phone custom control
(and also Im not that familiar with c# - but ill give it a try if its only way to create the control)
I will appreciate all the input!
I saw your post about SSN box - but I wasnt quite sure how would i accomplish it in phone custom control
(and also Im not that familiar with c# - but ill give it a try if its only way to create the control)
I will appreciate all the input!
Are you going to put this text box into a DataGrid, DataList or Repeater? This will affect where you add the attributes that will call the JavaScript routine to enforce numers only. Also, you say three text boxes... so you want one for area code (3 characters), one for prefix (3 characters) and one for the last four digits?
If this is the case, you can approach it as a custom control, or you can use three text boxes and add the necessary attributes and properties depending on which one it is. Using three text boxes and just add attributes will be the easier of the two, but if you really want to do the custom control, that's fine as well. If you have the time to try the custom control approach, I recommend it as it will expose you to the REAL flexibility of ASP.NET
Let me know on the above, and we'll go from there...
John
If this is the case, you can approach it as a custom control, or you can use three text boxes and add the necessary attributes and properties depending on which one it is. Using three text boxes and just add attributes will be the easier of the two, but if you really want to do the custom control, that's fine as well. If you have the time to try the custom control approach, I recommend it as it will expose you to the REAL flexibility of ASP.NET
Let me know on the above, and we'll go from there...
John
ASKER
I do not intend to put the textbox to Datagrid, repeater or datalist.
I just want to create "phonebox" custom control which i could use in the forms for user input (in the userInterface it should appear as 3 separate textboxe - first for are code and last two for numbers)
I just want to create "phonebox" custom control which i could use in the forms for user input (in the userInterface it should appear as 3 separate textboxe - first for are code and last two for numbers)
OK... I need to get dinner and a couple of other things squared away. I'll post something by later this evening that hopefully should get you started tomorrow morning.
John
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It looked great - only problem is that for some reason it cannot find those javascript functions.
How exactly should this .js file look like?
How exactly should this .js file look like?
ASKER
EXCELLENT (my own fault - tried to attach file like this:
Dim js As String = "<script language='javascript' src='/newmpow/Scripts/Phon eNumberBox .js'></scr ipt>")
However - added the script as inline tu PhoneNumberControl.vb file and it WORKED!!!
THANK YOU SOSOSO MUCH!!!
Ill buy you a dinner if you happen to come by NY
Dim js As String = "<script language='javascript' src='/newmpow/Scripts/Phon
However - added the script as inline tu PhoneNumberControl.vb file and it WORKED!!!
THANK YOU SOSOSO MUCH!!!
Ill buy you a dinner if you happen to come by NY
Gee, New York steak... I'll have to take you up on that sometime... :-)
Glad it worked. Just to mention again, the JavaScript is IE compliant. If your users use other browsers, they might get unexpected results.
John
Glad it worked. Just to mention again, the JavaScript is IE compliant. If your users use other browsers, they might get unexpected results.
John
ASKER
Thank you John - I have couple of things still to solve with that control -
take a look if you are interested:
https://www.experts-exchange.com/questions/21175916/Issues-with-Custom-PhoneBox-Control.html
take a look if you are interested:
https://www.experts-exchange.com/questions/21175916/Issues-with-Custom-PhoneBox-Control.html
John