problem with search
Hey, I've a search in website. If i search for a particular world it works fine in all pages but not in contact us. contact us page contains validation controls. I tried with removing validation controls, then the search works fine. any help on these how to make search though validation controls, are present.
function KeyPress(txt) { //alert(txt); if(txt == "Search") { 开发者_运维百科 document.getElementById("ctl00_txtSearch").value = ""; } } function OnBlur(txt) { if(txt == "") { document.getElementById("ctl00_txtSearch").value = "Search"; // txtSearch.style.color = "silver"; } } function button_onclick() { if(document.getElementById("").value == "" || document.getElementById("").value == "Search ") { document.getElementById("").focus(); alert("Please Enter Text"); return false; } }
I think you need to do validation group for each page and for each set of controls. Another things you can do the third party search component like following.
http://www.sitesearchasp.net/
try this.
Please put Validation Group of validation controls to some value and in the case of search button give another name for validation group.I hope it will work for u.
<asp:RequiredFieldValidator ID="Date" runat="server" ControlToValidate="txtDate" ErrorMessage="Please give a Date here" ValidationGroup="Group" ForeColor="White">*</asp:RequiredFieldValidator>
<asp:LinkButton ID="btnSave" runat="server"
ValidationGroup="Group">Save</asp:LinkButton>
<asp:LinkButton ID="btnSearch" runat="server"
ValidationGroup="abc">Search</asp:LinkButton>
For search button you put some other validation group.
精彩评论