.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

How object.GetType() works?

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


What object.GetType method does to determine the actual type at runtime? I'vea method that takes an object[] array. The array holds entities of different types, e.g, Product and Order.

object[] items = new object[2];
items[0] = new Product();
items[1] = new Order();

Now I am calling this code:


It gives me the exact type information which is Product in this instance. Can anybody explain me how object.GetType resolves the exact type at runtime?

View Complete Post

More Related Resource Links

An object reference is required for the nonstatic field, method, or property 'object.GetType()'


I'm getting this error, what i'm missing?

error: An object reference is required for the nonstatic field, method, or property 'object.GetType()'


static public void RegisterScriptMethod(System.Web.UI.Page page, string methodName, string methodBody)


StringBuilder sb = new StringBuilder();


"<script language='javascript'>");


"function " + methodName + " {" + methodBody + "}");



//page.RegisterClientScriptBlock(methodName, sb.ToString());

object (movie) not playing live - works on local


I have a small web app (using vb.net/asp.net) that I have created a control with an oject and I show a short video.  The video is a .mov file.  When I run the page on my local testing machine, it works just fine.  When I move the files to the server and test it, the movie just won't play.   There are no errors on the page or anything, the movie just won't play.  I know the path to the video is correct.  When I click play, it says 'Opening Media' for 1 or 2 seconds and then it goes back to the ready state.  I'm wondering why it works locally but not on the server.  Does the server need a media player?

Here's my control:

<object id="<%= ClientID %>_Player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="<%= Me.Width %>" height="<%= Me.Height %>" style="margin:0px auto; z-index:10000">    
<param name="URL" value="<%= me.VideoUrl %>" />    
<param name="autoStart" value="false" />    
<param name="uimode" value="Full" />    
<%--<param name="autoplay" value="True" />--%>    
<embed id="<%= ClientID %>_Embed" type="application/x-mplayer2"

Does Sharepoint new Client Object Model works with SharePoint 2007


I am able to test this new Client OM successfully with SharePoint 2010.


Would it support SharePoint 2007 & SharePoint 2003?


How do you retrieve data from older SharePoint Server ?

Ronak Patel

Getting Object required, but page function still works..


Want to clear the yellow exclamation point in the browser.. it builds fine, it works fine, but if you happen to look down in the bottom or your browser is setup to display these errors, you will get  an error message that reads

Object Required
Code: 0
Line: 13

When i view the source of the page here is what i have for those lines, then below that is how its written in the aspx page, what did i miss or do wrong?


<script type="text/javascript">
        function showsearchMenu(num) {
            for (var i = 0; i <= 4; i = i + 1) {
                if (i != num)
                    document.getElementById('searchNav' + i).style.display = "none";  --------------->>> This is line 13
                    document.getElementById('searchNav' + i).style.display = "block";
        function goSearchOption(theoption) {
            for (var i = 1; i <= 3; i = i + 1) {
                if (i != theoption)
                    document.getElementById('searchOption' + i).style.display = "none";
                    document.getElementById('searchOption' + i).style.display = "block";

How Javascipt Object Model SP.Core.js works? what is under it?


Hi, when u use methods of Sharepoint Javascript API , what exactly happens?

Under it is a webservice? or simple http protocol that comunicates with Sharepoint?

And can it be used anonymously or only when logged in?  Do I must provide some credentials to use it?

Trying to instantiate an object of a given type - works if the type has no dependencies, fails if it


In order to instantiate an object of a given type, I'm using the following code


public void LoadAssembly(string pathToAssembly, string assemblyTypeName)
      Console.WriteLine("INFO - Found the Assembly file " + pathToAssembly);
      string fullPath = null;
        fullPath = Path.GetFullPath(pathToAssembly);
        Console.WriteLine("Full path to assembly is " + fullPath);
        Assembly asm = Assembly.LoadFile(fullPath);
        if (asm == null)
          Console.WriteLine("ERROR - Failed to load Assembly: " + fullPath);
        foreach (var item in asm.GetTypes())
          Console.WriteLine("INFO - Found Type: " + item.FullName);
        Type type = asm.GetType(assemblyTypeName);

Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

C# Object Oriented Programming

So far in C# Essentials we have looked at the basics of programming in C# such as variable types and flow control. Although it would be possible to write a functional program using these techniques, there is much more to becoming a proficient C# programmer. C# is, above all, an object oriented programming language and as such any C# programmer will be expected to create object-oriented applications using this language.

Object Oriented Programming

Four core concept of OOP Object Oriented Programming. 1.Inheritance, 2.Polymorphism, 3.Abstraction and 4.Encapsulation

Object-Oriented Programming Concepts

This is the first in a series of articles describing the use of object-oriented programming techniques as implemented by the C# programming language. This series follows the C# Fundamentals tutorial that beginners are advised to read first.

Overview of SharePoint Object Model

SharePoint offers a set of structured server-side objects those are widely used to program SharePoint Applications. These objects are hierarchically arranged and you can drill down through the object hierarchy to obtain the object that contains the components of SharePoint Application you need to use in your code.

What is the difference between "dynamic" and "object" keywords?

Let's take a quick look at the object keyword first. I'm not going to talk a lot about it because it's been around since C# 1.0. This keyword is nothing more than a shortcut for System.Object, which is the root type in the C# class hierarchy. (However, as Eric Lippert pointed out in his blog post, not everything in C# derives from object.) This is a powerful mechanism, since you can assign almost any value to instances of this type.

How to bind GridView and DropDownList controls using DataTable object

In .net framework 2.0, you can load a DataTable in memory by consuming a data source using a DataReader. In this version you will find the flexibility in accessing the DataReader means write access code once and use again and again using DataReader. To see the functionality of DataTable consider an example that is created using VS2005.

Code works on aspx but not ascx


Not sure which category to put this question in, so I will put it in here.

Just to give you an idea of the layout of my solution, I have the main project, along with 2 class libraries, BLL and DAL.  (Business Logic Layer and Data Access Layer)

The BLL refers to the DAL and the main project refers to the BLL.

I had a test website and the code worked fine, but the same code will not work on the real project. The only difference is that in the test project, the code was on an aspx code behind, whereas in the real project, it is an ascx code behind (Web User Control )

The code is:

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString
        Dim recordEntry As New UserRecord(connectionString)
        recordEntry.UserName = "TestName"
        recordEntry.BMI = bMI
        recordEntry.BMR = bMR
        recordEntry.FTM = fTM
        recordEntry.TDEE = tDEE
        recordEntry.TodayDate = dateForToday

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString

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

Pass ASP.NET membership identity object across domain?


I am trying to figure a way to SSO with ASP.NET membership and role model.

I can implement custom membership provider which consume web services hosting on a server.

With encryption of data. No problem.

But my question is, If I sign on a website with my provider, got my identity object on that application,

could I pass it to another website on another domain which use the same provider and by doing so, do not need to login again?

If this is possible, I am going to implement this solution. Please tell me what's your take on this.

Send object from one page to another



I want to create object in 1.aspx, and then send it to 2.aspx. This methods are bad, because:

1)Send object with url, like this:


This is not confidential.


Session["field1"] = "12345"; // set
Object foo = Session["field1"]; // get

This is bad too, because in 2.aspx this fields send to textboxes, and if user go to 2.aspx without 1.aspx, he'll see old data. 

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