This is a migrated thread and some comments may be shown as answers.

Microsoft JScript runtime error: Unable to get value of the property 'length': object is null or undefined

0 Answers 52 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Sunil
Top achievements
Rank 1
Sunil asked on 22 Oct 2012, 01:12 PM

Hello friends,

I am using C# and asp.net to do the following.

When the customer clicks the Transmit Button, I need to have a confirm popup. When the customer presses "Ok", I need to continue with the code behind function. For this I used asp.net ModalPopupExtender. And Created 2 functions in the code behind for "OK" and "Cancel" click events. My aspx code is as follows:

<!-- Panel --> 


<asp:Panel ID="pnlIssues" runat="server" BorderColor="Black" BorderStyle="Outset" BorderWidth="2" BackColor="Wheat" Width="400px" Height="106px">

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate> 

<asp:Button ID="btnWarning" runat="server" Text = "Cancel" OnClick ="RefreshAfterCancel_Click" CausesValidation="false" />
<asp:Button ID="btnOK" runat="server" Text = "OK" OnClick="TransmitAfterOK_Click" CausesValidation="false"/>
</ContentTemplate>
</asp:UpdatePanel> 


</asp:Panel> 


<ajaxToolkit:ModalPopupExtender ID="WarningModal" TargetControlID="dummyLink2" BehaviorID="WarningModal" PopupControlID="pnlIssues" runat="server" ViewStateMode="Enabled" CancelControlID="btnWarning" OkControlID = "btnOK">
</ajaxToolkit:ModalPopupExtender>

<asp:HyperLink ID="dummyLink2" runat="server" NavigateUrl="#" />

This is the code behind:

protected void TransmitButton_Click(object sender, EventArgs e)

WarningModal.Show();

}

protected void RefreshAfterCancel_Click(object sender, EventArgs e)
{
try
{

Response.Redirect("~/ManageCases.aspx?CaseID=" + GlobalData.CaseID.ToString());

}
catch { }
}

protected void TransmitAfterOK_Click(object sender, EventArgs e)
{

.......}

But when I click the transmit button, it opens the popup and when I click "OK" it gives me the error:

"Microsoft JScript runtime error: Unable to get value of the property 'length': object is null or undefined".

When I click "break" and continue, it does what its supposed to do. I don't understand why it gives the error. This error only shows up in internet explorer. It works fine in FF and Chrome. Also, I am using RADScriptManager in my masterpage.

Any help will be greatly appreciated. I have been trying to figure this out for two days without any luck. I have tried all the tips that were answered for this error message, but still doesn't work for me. Thank you in advance.

No answers yet. Maybe you can help?

Tags
Ajax
Asked by
Sunil
Top achievements
Rank 1
Share this question
or