0

i am getting this error when the below condition match, i am using the below code in Content page and in my master page i have this

<asp:ScriptManager EnablePartialRendering="true" EnablePageMethods="true" ID="smgr" runat="server" />

Error: Microsoft JScript runtime error: Object expected

 if (lstRecipient.Items[i].Text == ddlRecipient.SelectedItem.Text)
 {
   lstRecipient.Items.RemoveAt(i);
   isDuplicate = true;
   ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertAdd", "jAlert('Recipient name is already in the list.', 'Duplicate Entry!');", true);
 }
Nick Kahn
  • 19,652
  • 91
  • 275
  • 406
  • if you have JavaScript function on your page, put Return False, http://stackoverflow.com/questions/855360/when-and-why-to-return-false-in-javascript – Safi Jun 27 '11 at 12:35

1 Answers1

1

This is typically caused when a jscript function cannot be resolved. Do you have a reference to the JQuery library containing the jAlert function?

Steve Danner
  • 21,818
  • 7
  • 41
  • 51
  • i have that in my Master page. – Nick Kahn Aug 04 '10 at 17:53
  • @Nisar Khan - Can you confirm that the library is getting loaded using a tool like Firebug? Path is correct? What happens if you change the code to a Javascript alert instead? Does it now work? What does the script block that is being generated look like? A few ideas of things to try. – DaveB Aug 04 '10 at 18:08
  • my scripts were in "" and i moved those scripts to section now its working. – Nick Kahn Aug 04 '10 at 18:37