user710502 user710502 - 3 months ago 22
ASP.NET (C#) Question

radtextbox validate url

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

Answer

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;
}