2011-05-26 54 views
0

我想在出现错误消息后添加链接。目前,我有这个在我的代码:添加错误消息附近的链接

<asp:CustomValidator ID="CV2" runat="server" ClientValidationFunction="Validate" 
    ForeColor="Red" OnServerValidate="Server_Validate" ValidationGroup="group" 
    ErrorMessage="You have not validated." Display="Dynamic" Enabled="false" 
    ControlToValidate="txtAmount" /> 

的JavaScript:

function Validate(source, arguments) { 
      var validAmount = document.getElementById('<%= validate.ClientID %>').innerHTML.replace('$', '').replace(/,/g, ''); 
      if (arguments.Value > validAmount) 
       arguments.IsValid = false; 
      else 
       arguments.IsValid = true; 
} 

C#代码:

protected void Server_Validate(object source, ServerValidateEventArgs args) 
{ 
    try 
    { 
    //Some C# code here. 
    } 
} 

什么是对此最好的方法呢?谢谢。

回答

0

你试过:

CV2.ErrorMessage = "<a href='www.google.com'>You have not validated.</a>"; 

我没有测试它,但我知道我可以添加标记到我的标签文本。