This one has me perplexed. I have a web app that does many functions, but the part that it is bombing out is when doing a Search function which calls a webservice and returns results back from DB2.
The odd thing, is the error doesn’t always occur and only seems to occur when accessing my web app through a vip(which is on a load balancer, round-robin on 2 IIS Servers). The error doesn’t come up when accessing the web app when using the direct URL for one of the servers.
Which leads me to believe, something with my web.config?
Also I searched my javascript code, and I don’t use Length anywhere.
Please help, i’ve been banging my head against the wall on this.
UPDATED with code(I included the neccessary code below, omitted the rest):
//Javascript***
function ValidateSearch() {
if (Page_ClientValidate("TransSearch") == true) {
ShowWait();
return true;
}
else {
return false;
}
}
function ShowWait() {
target = document.getElementById('progress');
document.body.appendChild(target);
spinner.spin(target);
//This calls spinner.js from github
}
function searchComplete() {
//clear previous search textboxes
document.getElementById('<%# txtEmail.ClientID %>').value = "";
document.getElementById('<%# txtPhone.ClientID %>').value = "";
spinner.stop();
}
//Markup***
<div class="searchlabel">
<label>Email Address</label><asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ID="EmailReq"
ControlToValidate="txtEmail" ValidationGroup="TransSearch"
Display="None"
ErrorMessage="<b>Required Field Missing</b><br />Email is required." />
<asp:ValidatorCalloutExtender runat="Server" ID="EmailReqE"
TargetControlID="EmailReq"
HighlightCssClass="validatorCalloutHighlight" />
</div>
<div class="searchlabel">
<label>Phone</label><asp:TextBox ID="txtPhone" runat="server" Font-Size="Medium"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ID="PhnReq"
ControlToValidate="txtPhone" ValidationGroup="TransSearch"
Display="None"
ErrorMessage="<b>Required Field Missing</b><br />Phone is required." />
<asp:ValidatorCalloutExtender runat="Server" ID="PhnReqE"
TargetControlID="PhnReq"
HighlightCssClass="validatorCalloutHighlight" />
</div>
<asp:Button ID="btnSearch" runat="server" Text="Search" Width="90px" OnClientClick="return ValidateSearch();" OnClick="Search_Click" />
//Codebehind***
public void Search_Click(Object sender, EventArgs e)
{
//passes search text to webservice
//fills gridview with returned data
//lastly calls javascript function to stop spinner
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "searchComplete", "<script type='text/javascript'>searchComplete();</script>", false);
}
Maybe your javascript function is not getting the textbox you are providing it with.
Check the value using:
if it is returning value. This maybe the reason your spinner.stop(); is not working.
Use alert to see if it is entering your function. I use it every time I am stuck in javascript . It helps me to find after which line the function is giving error.