我正在用 asp.net 网络表单创建网站。我在表单 (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);
}
我现在有验证问题。当我在带有验证字段的联系表上并且此字段为空时,当我尝试通过单击链接内的图像来更改语言时,而不是更改站点的语言,我有验证的命令。我可以在这里做什么?
最好的问候, 达格纳