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

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

jQuery and Master Pages - Object expected

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :ASP.Net

Here is the layout of my problem: I have a Master Page that is referenced by pages in the root of my site, as well as some pages in an 'Admin' folder. All of that works just fine. I added some jQuery to add some features to an auto-search textbox, and placed the code referencing the jQuery file and the script in the head section of the Master Page. The script looks a little like this:  

       SelectText(this); // Function to call on click event.

I just used the actual id generated by ASP.NET to grab the textbox to avoid the "what's the actual id?" issues. When the home page loads, all is well. When I try to navigate to one of the pages in the 'Admin' folder, I get an 'Object expected' error. At first I thought it was due to a possible renaming of my textbox, but I checked the source of the page and this was not the case. In fact, I removed all of the script code except the:


part, and the 'Object expected' error still occurs. I am only setting up the jQuery here, and it still throws an exception. I have no idea what is causing

View Complete Post

More Related Resource Links

Master Pages and object persistence


Hi. I'm new to MVC2. I  build a menu, based on jquery and xml. 

My ideia was to have this menu on mvc master page, and the submenus had action links to several other views, who would show up in one or several asp ContentPlaceHolder.

On another post, ignatandrei, show me this: http://msprogrammer.serviciipeweb.ro/2010/07/19/asp-net-mvc-pass-data-from-a-view-to-master/, which i was really nice but don't solve my problem. which is that when i click on any element of menu, i'll get erro because any call to my menu object is made to an null object. 

How can i make objects became persistent in my master page, regardeless the views i want to show up in content holders, because after i click on menu subitem (html.action) they made the previous menu object became null?

I tried using partial views, adapt the upcode example to my situation, and several others ideias - none has resulted. 

When i readapt the code on upper link, i got issues regarding objects types that didn't match - which is something that i think is related to what page inherits?

Resumed, is it possible to have a similar behavior to asp.net no mvc regarding master pages? 

jquery with master pages


i have an application that uses a master page.  i have an asp textbox named "TextBox1" on one of the subpages.

i have the following script code in my java script function:

var ti = document.getElementById("TextBox1");

Master-Detail with the GridView, DetailsView and jQuery's ThickBox

One more article about grids from Matt Berseth. This time he shows how to create master-detail with the gridview, detailsview and jQuery's ThickBox. He writes:
So I thought I would check some of this out and along the way rebuild my Master-Detail with the GridView, DetailView and ModalPopup Controls and replace the ModalPopup with jQuery's ThickBox. I found it pretty interesting - read on to see how it went

Master-Detail with the GridView, DetailView and jQuery's ThickBox

An example of using the jQuery ThickBox with ASP.NET's GridView and DetailView controls

Master Pages in MOSS 2007

'MasterPages' feature in sharepoint 2007 makes the entire customization job easy.In 2003 we used to face lot of issues to get the same look and feel and the standard behaviour for overall site. In 2007, customizing the look and feel for the entire site can be done in a simple way by using 'MasterPage' feature.

Business object design in master details.


Hello guys, I have the following scenario,

  1. There is a master business object containing 40 fields
  2. 2 separate child business objects
  3. If I update a child record, I have to update master's 'Last modify by' status along with 3 or more fields in master
  4. For this purpose, I don't want to initialize a separate Master class object (as most of the fields are unused/wasted)
  5. The 'last modify by' also gets updated if the records in master get updated themselves

Currently I have separate business objects for master table, Child 1, Child 2 etc.

How do I control this in my business object design ? Do I break up my master object ? Say I extract last 'modify by ' into a new class, through inheritance or some other way ?

Is there a way that whenever child gets updated I use a 'small' class to update Master status only and whenever the master itself gets updated I do the same.

Problem is that I am having redundancy in my small class (Master class also contains 'Last Modify By ',

What would you advice. Please have your say. Thank you.

Edit  I am using webforms guys.

Posting data to ASMX and return Object for jQuery


I am using fluent NHibernate with WebForms and I am trying to build a page where I allow a user to post a status update on their profile page and I a using a .asmx WebService to post the data to the database and then returnig a StatusUpdate instance to the page to be used by jQuery. I have a couple problems.

1) First off when I return a string from the WebService(i was testing) the textbox where the user enters their status doesnt empty the contents. And since the page doesnt refresh even if I manally clear out the textbox and put in something else, it still posts the previous status to the database again. How do I fix this?

2) Secondly, when I return the StatusUpdate Object from the Webservice I cant the results to display anything. Like I sad, Im using jQuery to make an AJX call to the WebService.

Here is my code:

User Profile Page:

Status: <asp:Label ID="status" runat="server"></asp:Label><span style="font-size:.7em;"><asp:Label ID="statustime" runat="server"></asp:Label></span><br />
<textarea id="statusBox" rows="3" cols="40"></textarea><br />
<input type="button" value="Update Status" onclick="SetStatus(); return false;

Master Pages: Master Your Site Design with Visual Inheritance and Page Templates


Master pages in ASP.NET 2.0 solve a problem many Web developers have been solving on their own with a variety of techniques for years - providing a single master template for an entire site. This article covers the details of master pages, discussing their usage and implementation and how they are a natural evolution of custom techniques developers are using today.

Fritz Onion

MSDN Magazine June 2004

Button click in master page use in other pages I have to click twice. Why?


In my masterpage I have a menu with buttons. I want the buttons to do something after click. It works but I have to click twice on the button, why? What do I have to do to just to click once?

how to change default menu tab in master pages?



i have 5 tabs in my master page application. how can i make 2nd tab as default?

any ideas?


Ajax and master pages


I have a site that uses master pages.  Some of my pages use ajax, so they have the scriptmanager on them.  I now have to add some ajax to one of the master pages.  When I try to display a page that already has a script manager on it, I get an error that I can only have one script manager.  Is there a way to deal with this other then searching for every page that uses the master page and ajax and removing the scriptmanager tag? 

I'm hoping to start using Ajax more and more, so I'm really more concerned with best practices then I am about having to find and remove tags.  What is the right way to use Ajax on master pages and some, but not all content pages?

Why do the aks master pages not get applied if the feature is not activated on the top site collecti


I installed AKS 2.0 and activated AKS feature. The problem I found was the aks master pages do not get applied if the feature is not activated on the top site collection. why is so?

example: If i activate the feature on http://<servername>/sites/<sitename> and apply the master page, I dont see any changes.

              But if i activate the same aks feature on http://<servername/ then everything started working on all sites.

              The reason i found is the CSS reference in the aks master pages.

              It reference should be given as follows:

                 for http://<servername>/sites/<sitename> ->  <link rel="stylesheet" type="text/css" href="../../Style%20Library/AKS/Aks_Band_Blueband.css"/>

                 for http://<servername>/ -><link rel="stylesheet" type="text/css" href="/Style%20Library/AKS/Aks_Band_Blueband.css"/>

So my question is, am i missing anything? am i supposed to activate the AKS feature on top level site collection at any cost? if yes, why is so? 

And after applying aks master pages, i see differnece in font sizes. Why the font size is getting changed?


Sharepoint 2007 - Wiki site - New Pages Not Inheriting Custom Master Page


I am working on a SP site (MOSS not WSS) which is heavily customised away from the OOTB layout. I need to create a Wiki site, which was going well - I've created a master page which displays the miniconsole (this was not visible with our customised layout), and made it the default master page for the site. This has been applied to the two standard pages that come with the Wiki site, however when a new page is created, it seems to inherit the default.master, rather than my custom master page - thus not showing the miniconsole.

When I have created a new page, I am able to use SharePoint Designer to attach my custom master page to it, which works perfectly, however this will not be a viable option going forward as end-users create their new wiki pages.

How can I get the new pages to inherit my master page when they are created?


Object expected error


<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

Inherit from multiple master pages


How does one inherit from multiple master pages?


I.e.  I have a base master page that contains several ContentPlaceHolders.









I want to have separate master page files (one for each ContentPlaceHolder) so that I have 4 separate files: 3 ContentPlaceHolders (each adding specific content) and 1 base master page.

The ASPX files will then inherit from the base master page.



Programmatically Hide Master Pages from Site Master Page Settings page?



I know there is a field you can check when you edit the properties of a Master Page in the Master Page Gallery to set a Master Page to hidden but ... can anyone think of a way to programmatically hide specific Master Pages from the Site Master Page Settings page?

Maybe this should be two questions:

  1. How do I programmatically access a Master Page in a Master Page Gallery?
  2. Is there a property that can be set that will hide the page from the Site Master Page Settings page?

Deploying master pages in sharepoint 2007

Present situation:   Client has dev environment and they have customized the default page which comes ootb and is in Page Library. Also Created Master page using Sharepoint designer, and made that master page as the default master page for the site. The proposed solution: For promoting to different environments we will have to move packages WSP's across environments.   The present situation: All the environments were restored by using site collection backup and restore option (stsadm -o restore ...)   The Problem: Can we overwrite the master pages, page templates which are presently in master page gallery and page library by using feature   Or is there a better way of doing this.   Can somebody specify a better option for promoting.  
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