Question

I have a radtextbox where I would like to prompt the user to enter a URL, is there a property that exists that validates this input in a radtextbox?, if not, what can I use to allow users to enter urls?.

I would appreciate any advise on this matter.

Regards

Was it helpful?

Solution

because they use a textbox and assign a mask with JavaScipt

ASP_BUTTON

<asp:TextBox runat="server" ID="txtOrigeenHup" CssClass="mycssMascara" Width="390px" 
     TextMode="MultiLine" Text='<%# Eval("urlOrigen") %>' 
     onfocus="OnFocus(this.id,'http://paginaEjemplo.com')" 
     onblur="OnBlur(this.id,'http://paginaEjemplo.com')">http://paginaEjemplo.com asp>

JAVASCRIPT

 function OnFocus(elementId, defaultText) {
if (document.getElementById(elementId).value == defaultText) {
    document.getElementById(elementId).className = "mycssMascara";
    document.getElementById(elementId).value = "";
}}
  function OnBlur(elementId, defaultText) {
var textValue = document.getElementById(elementId).value;

if (textValue == defaultText || textValue.length == 0) {
    document.getElementById(elementId).className = "mycssMascara";
    document.getElementById(elementId).value = defaultText;
}
else
    document.getElementById(elementId).className = "mycss";  }

CSS

 .mycssMascara
{
 font-weight: normal; color: #808080; background-color: #FFFFFF; border: 1px solid #C0C0C0; letter-spacing: 0pt; word-spacing: 1pt; font-size: 14px; text-align: left; font-family: arial, helvetica, sans-serif; line-height: 1; margin: 4px; padding: 6px;
}

.mycss
{ font-weight: normal; color: #000000;  background-color: #FFFFFF; border: 1px solid #C0C0C0; letter-spacing: 
0pt;  word-spacing: 1pt; font-size: 14px; text-align: left; font-family: arial, helvetica, sans-serif; line-height: 1; margin: 4px;  padding: 6px;
}

OTHER TIPS

Use InputType

As of Q3 2011 RadTextBox provides support for the new HTML5 input types

Example:

<telerik:RadTextBox ID="txt1" runat="server" RenderMode="Lightweight" Label="Image Url: " MaxLength="100" ToolTip="Put URL ..." InputType="Url" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top