本文介绍了如何在单击菜单的锚标签时绕过验证。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我为插入模式formview(AddVenue.aspx)的几个字段设置了require字段验证器。它在我的插入按钮的点击事件上正常工作。但是当我浏览我的菜单栏(AddVenue.aspx)的几个菜单/子菜单(包含点击事件)时,所有验证都会触发。请帮助我如何避免菜单和子菜单的点击事件验证。
我尝试过:
AddVenue.aspx.cs
I have set require field validator for few fields of insert mode formview(AddVenue.aspx). Its working fine on click event of my Insert Button.But When I am navigate through few menus/submenu(which contains click event) of my menubar(AddVenue.aspx), all validation is getting trigger. please help me how I can avoid validation on click event of menu and Submenu.
What I have tried:
AddVenue.aspx.cs
public void click_Vendor1(object sender, EventArgs e)
{
Vendor1.CausesValidation = false;
Session["VendorCategory"] = "Photographers";
Response.Redirect("SearchVendor.aspx");
}
public void click_Vendor2(object sender, EventArgs e)
{
Vendor2.CausesValidation = false;
Session["VendorCategory"] = "Makeup Artists";
Response.Redirect("SearchVendor.aspx");
}
public void click_Vendor3(object sender, EventArgs e)
{
Vendor3.CausesValidation = false;
Session["VendorCategory"] = "Mehendi Artists";
Response.Redirect("SearchVendor.aspx");
}
public void click_Vendor4(object sender, EventArgs e)
{
Vendor4.CausesValidation = false;
Session["VendorCategory"] = "Decorators";
Response.Redirect("SearchVendor.aspx");
}
public void click_Vendor5(object sender, EventArgs e)
{
Vendor5.CausesValidation = false;
Session["VendorCategory"] = null;
Response.Redirect("SearchVendor.aspx");
}
AddVenue.aspx
AddVenue.aspx
<ul>
<li><a href='#' runat="server" id="Vendor1" onserverclick="click_Vendor1">Photographers</a></li>
<li><a href='#' runat="server" id="Vendor2" onserverclick="click_Vendor2">Makeup Artists</a></li>
<li><a href='#' runat="server" id="Vendor3" onserverclick="click_Vendor3">Mehendi Artists</a></li>
<li><a href='#' runat="server" id="Vendor4" onserverclick="click_Vendor4">Wedding Lawns</a></li>
<li><a href='#' runat="server" id="Vendor5" onserverclick="click_Vendor5">All Wedding Vendors</a></li>
</ul>
推荐答案
这篇关于如何在单击菜单的锚标签时绕过验证。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!