2012-06-17 63 views
0

我在asp.net web窗体中创建网站。我在形式加入验证,以场(ASP:RequiredFieldValidator的),我使用页面上的多语言,如下:多语言和表单验证

我有链接按钮这样的:

<asp:LinkButton ID="lnkSetEnglish" runat="server" CommandArgument="en-GB" OnClick="RequestLanguageChange_Click"> 
    <img src="Images/logos/en.png" alt="English" /> 
</asp:LinkButton> 

和功能

protected void RequestLanguageChange_Click(object sender, EventArgs e) 
    { 
     ImageButton senderLink = sender as ImageButton; 

     HttpCookie cookie = new HttpCookie("CultureInfo"); 
     cookie.Value = senderLink.CommandArgument; 
     Response.Cookies.Add(cookie); 

     //Set the culture and reload the page for immediate effect. 
     //Future effects are handled by Global.asax 
     Thread.CurrentThread.CurrentCulture = new CultureInfo(senderLink.CommandArgument); 
     Thread.CurrentThread.CurrentUICulture = new CultureInfo(senderLink.CommandArgument); 
     Server.Transfer(Request.Path); 
    } 

我现在有问题验证。当我在与验证字段的联系表单上,并且此字段为空时,当我尝试通过点击图像链接内部的语言来更改语言时,而不是更改网站的语言时,我已从命令验证。我能在这里做什么?

最好的问候, 达格纳

回答

1

设置的CausesValidation为false LinkBut​​ton的