.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Object expected error

Posted By:      Posted Date: August 26, 2010    Points: 0   Category :ASP.Net

<input type="button' onclick="timeoutCheck()" value="Click Me!" />

it tells me Microsoft JScript runtime error: Object expected


timeoutCheck() is my script function that i declared above the input tag

can anyone tell me why i am getting this error

hello i need help , any ideas are welcome i have been working on this for two weeks now and cannot seem to be able to advance

View Complete Post

More Related Resource Links


Hi all,Here's some simple code<a href='<%= string.Format("../Print/Print1.aspx?withParameter={0}", Para )%>'>HyperLinkText</a>and it works well. so i guess i can write anything like this, so i wrote a test:<input type="button" value="Btn1" onclick='<%= string.Format("window.open('','_blank')") %>'/> <input type="button" value="Btn2" onclick="window.open('','_blank')"/>However, Btn1 does not work.. for some reason i have to NOT to use server control, so i wite it in inline-code style,why the first hyperlink work well, but Btn1 fails?could anyone tell me?thank you~

Timer job intiation error: SharePoint cannot deserialize an object of type

Hi All, when i run a timer job (One-Time timer) it has added it to Timer Job definitions in the Central Administration. I have checked the Log file in 12 hive and found the following error..... "SharePoint cannot deserialize an object of type xyz.xyzJob, xyzTimer, Version=, Culture=neutral, PublicKeyToken=<token> on this machine. This typically occurs because the assembly containing this type is not installed on this machine. In this case, this message can be safely ignored. Otherwise, the assembly needs to be installed on this machine in a location that can be discovered by the .NET Framework." The above error says that the assembly is not added.... but it has been already added to the GAC. Can anyone guide me about the issue and how to resolve that........?

Membership web part 'Object Expected' error

I have placed a Membership Web Part on my 'My Site'/'My Content' page and everything was working just fine until the number of memberships supassed the total number that the control is set to display. When this happened, a link appeared at the bottom of the web part with the following wording 'Show 8 additional memberships'. When I click on this link I receive an 'Object Expected' javescript error. When I look at the code that is generated on the page the <a></a> tag for this link appears as follows ... <a class="ms-vb" id="1SPS_MEMMICSRCHRES_Link" href="javascript:ShowHidePrivacyRow('SPS_MEMMICSRCHRES','1', '1SPS_MEMMICSRCHRES_Link', 'Hide 8 additional memberships', 'Show 8 additional memberships');"> When I do a search for the ShowHidePrivacyRow() function it does not appear on the page and I can not seem to find it in any of the SharePoint out of the box .js files either. Could this be the cause of the 'Object Expected' error? If so, how do I solve this and why is an out of the box web part causing javascript errors. This is something I would expect from a product that is still in Beta, not a production release.

IE script error (object expected) on treeview

Hi,Just starting out with the CSS adapters and have implemented a treeview. Works fine in Firefox butIE shows a script error (bottom left) when moving over the tree view. It still goes to the page but there is obviously an issuePage code is in a master page below is the source view in IE<script type="text/javascript">//<![CDATA[var theForm = document.forms['aspnetForm'];if (!theForm) {    theForm = document.aspnetForm;}function __doPostBack(eventTarget, eventArgument) {    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {        theForm.__EVENTTARGET.value = eventTarget;        theForm.__EVENTARGUMENT.value = eventArgument;        theForm.submit();    }}//]]></script><script src="/countrystovesdirect/WebResource.axd?d=KFBAefcFIGtf1hLcg-tm2g2&amp;t=634172878000000000" type="text/javascript"></script><script src="/countrystovesdirect/WebResource.axd?d=S53dmqAagvRk26h8P3H5I9pat_c17l9dW6l04Xdzs9Ai0yVsPFqiIf_M-ylpvzDHp0GeDDnhMnCondcznfbzzw2&amp;t=634201551800000000" type="text/javascript"></script><script src="/countrystovesdirect/WebResource.axd?d=S53dmqAagvRk26h8P3H5I9pat_c17l9dW6l04Xdzs9ACFhsw16G3-NkgCeZFVUFx6W

ClientScript error: JScript Object expected error



I have a window A which has a lookup button opening a Student LookUp window.  StudentLookUp is supposed to return the selected student to window A.  Below is Student Look Up Code.  I'm running into Microsoft JScript: Object expected error on the ClientScript.RegisterClientScriptBlock. 

Please help!




<title>Student Search</title>
<h2 align="center">Student Search</h2>
<script type="text/javascript" >
    function SubmitStudent(StudentId, StudentLastName, StudentFirstName, StudentMiddleName, BirthDate, SchoolId) {
        self.opener.SetStudentInfo(StudentId, StudentLastName, StudentFirstName, BirthDate, SchoolId);
<body align="center">
<form id="form1" runat="server">
<asp:HiddenField ID="SelectedStudentId" runat="server" />
<table align="center">
    <tr><td>Last Name:  </td><td><asp:TextBox ID=

Error 2 Type or namespace definition, or end-of-file expected


Hi frnds,

I am new to this programming.. I am trying to download files from a specific folder in ftp server. after downloading those files i want to store in my computer. . I got the code on internet but wen i am trying i am getting this error Error 2 Type or namespace definition, or end-of-file expected. .  please help me very urgent. here is my complete code


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Net;
using System.Text;
using System.Runtime.InteropServices;

public partial class _Default : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e)
        string[] files = GetFileList();
        foreach (string file in files)

        public string[] GetFileList()
            string[] downloadFiles;
            StringBuilder result = new StringBuilder();
            WebResponse response = null;
            StreamReader reader = null;
                FtpWebRequest reqFTP;
                reqFTP = (FtpWebReq

Error occurred in deployment step 'Add Solution': An object of the type Microsoft.Office.InfoPath.


While trying to deploy custom SharePoint workflow solution in VS 2010, along with InfoPath custom task edit form, I ran into the following error message.

Error occurred in deployment step 'Add Solution': An object of the type Microsoft.Office.InfoPath.Server.Administration.FormTemplate named xxx already exists under the parent Microsoft.SharePoint.Administration.SPFarm named xxx Rename your object or delete the existing object

How can I resolve this problem? I have did some research but none helpful so far.


Blog: http://convergingpoint.blogspot.com/

Error occurred in deployment step 'Activate Features': Unable to cast object of type


I keep getting this error when trying to deploy a feature to use a customizable master page>  I verified that I my scope is at the web level.

Error 43 Error occurred in deployment step 'Activate Features': Unable to cast object of type 'Microsoft.SharePoint.SPWeb' to type 'Microsoft.SharePoint.SPSite'.
  0 0 FsMECCMaster


using System;

using System.Runtime.InteropServices;

IE script error (object expected) on treeview



Just starting out with the CSS adapters and have implemented a treeview. Works fine in Firefox but
IE shows a script error (bottom left) when moving over the tree view. It still goes to the page but there is obviously an issue

Page code is in a master page below is the source view in IE

<script type="text/javascript">
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;

<script src="/countrystovesdirect/WebResource.axd?d=KFBAefcFIGtf1hLcg-tm2g2&amp;t=634172878000000000" type="text/javascript"></script>

<script src="/countrystovesdirect/WebResource.axd?d=S53dmqAagvRk26h8P3H5I9pat_c17l9dW6l04Xdzs9Ai0yVsPFqiIf_M-ylpvzDHp0GeDDnhMnCondcznfbzzw2&amp;t=634201551800000000" type="text/javascript"></script>
<script src="/countrystovesdirect/WebResource.axd?d=S53dmqAagvR

SPGridView Control: Paging Error - "Unable to cast object of type 'System.Int64' to type 'System.



I'm creating project in VS 2010 using VisualWebPart. I'm using SPGridView for my grid in the web part. To acheive this, I've done following:

I added following xml in my ascx control

<SharePoint:SPGridView runat="server" ID="grdView" AutoGenerateColumns="false" AllowPaging="true" PageSize="2&

override error message (The value 'test' is not valid for Age) when input incorrect data type for in


Hello everyone,

I've tried to override error message when input incorrect data type in input field on HTML form. For example I have the model like this.

public class Person
public string FirstName {get;set;}
public int Age {get;set;}


For view, I put text input for Age to get it value.

When type some string in Age text box like 'test' and press submit button. I got this error message

The value 'xxx' is not valid for Age

However, I want to change this message and try many way. There 's nothing effect this message value.

Please could you help me to solve this problem.

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo

Type or namespace error.


A couple of days ago I started getting an unusual behavior when compiling Website projects. I have referenced class libraries added to my bin folder that are also correctely referenced in using statements in my aspx.cs code behind. When I compile, I get the 

Error 4 The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?) C:\Dev\Fiscal_Portal\Implementation\FMS Portal Site_new\App_Code\BLL\DataTables.cs 1 7 C:\...\FMS Portal Site_new\

The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?)

error message that would typically be received when the dll has not been added as a reference or added in a using statement.

I can eliminate the error by adding an


command object error


Could someone please tell me what is wrong with my syntax here?  I'd be much appreciative.


objCmd = New SQLCommand("SELECT CASE WHEN objDR('Item') = 'Enter Bill of Lading' then enterbol " _  

& "WHEN objDR('Item') = 'Bill of Lading History' THEN bolhistory " _  

& "WHEN objDR('Item') = 'Request Transfer' or objDR('Item') = 'View Transfer in Progress' THEN transfers " _  

& "END  from plantGroups where plantgroupid=@plantgroupid", objConn)

type object parameter



I have a problem I can't figure out.

I've been trying to add a listbox with multi select enabled as a parameter to my select statement in sqldatasource.

So i created a function like this :

string strItemTypes = "";
foreach (ListItem li in lbItemType.Items)
   if (li.Selected)
      strItemTypes += "," + li.Value;
strItemTypes = strItemTypes.Substring(1);

which gives me the selected items like this for example : "1,2,3"...
Then I've been trying to add it to my sql select statement :

SELECT tblOfficesItems.idOfficesItems, tblStockItems.Name, tblStockItems.Description, tblStockItemTypes.TypeItem, tblStockItems.Notes FROM tblOfficesItems INNER JOIN tblStockItems ON tblOfficesItems.fkItem = tblStockItems.idItem INNER JOIN tblStockItemTypes ON tblStockItems.fkTypeItem = tblStockItemTypes.idTypeItem WHERE tblStockItems.fkTypeItem IN ( @fkTypeItems )

using a hiddenfield with a controlparameter of type=object
but it just don't seem to work, seems like the data just won't bind or something and I don't get any errors so I'm confused!!

then i tried this :

SELECT tblOfficesItems.idOfficesItems, tblStockItems.Name

Activation error occured while trying to get instance of type Database, key "DBName"


Im using Enterprise library 5.0
I have a scenario, where I have to access two different databases in my application.

Basically this application is a webservice,delployed on my local for testing purpose.
I'm trying to access this web method from diffent windows application, default connection works fine but the other database throw's exception.

Problem is only my defaultDatabase is works fine, if I change defaultDatabase="MYCON1" with "MYCON2" it works fine, if I try to access the other database which is not default, throws exception.

<dataConfiguration defaultDatabase="MYCON1" />
<add name="MYCON1" connectionString="Data Source=server1;Initial Catalog=dbName1;User Id=Username1;Password=password1;"

" />
<add name="MYCON2" connectionString="Data Source=Server2;Initial Catalog=dbName2;User Id=Username2;Password=password2;"
providerName="System.Data.SqlClient" />

Database myDB=EnterpriseLibraryContainer.Current.GetInstance<Database>(); --> works fine for the default database (MYCON1)

Database myDB=EnterpriseLibraryCo

Registering controls of current assembly object reference NOT set error


Hi There,

I have created a simple ASP.net Web Application (2.0) and have added a web user control.

Now in my page I have added this control but I have registered like this,

<%@ Register Assembly="WebApplication1" Namespace="WebApplication1" TagPrefix="Custom" %>

Which means I want to access all the controls in my current Web Application project

Then I have added my user control like this,

<Custom:MyUserControl ID="MyUserControl1" runat="server" PublicProperty="Hello" />

Every thing is fine but when I execute the project, NO control on my user control gets "instantiated" and thus I receive error "Object Reference Not Set"

Note that My Control has,

1) Public property PublicProperty as String

2) 1 Label control

In Load Event Handler I am setting Text property of Label Control to PublicProperty. Here object reference NOT set error occurs (which means Label control is NOT initialized).

I don't want to register my control using Src, TagPrefix etc. Any ideas?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend