views:

42

answers:

1

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);
 }
+1  A: 

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
i have that in my Master page.
Abu Hamzah
@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
my scripts were in "<asp:ContentPlaceHolder ID="head" runat="server">" and i moved those scripts to <head> section now its working.
Abu Hamzah