.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

Thinking about new C# method prototypes: object as dictionary

Posted By: Rahul     Posted Date: October 25, 2009    Points: 2   Category :.NET Framework
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.

View Complete Post

More Related Resource Links

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

Object does not support this property or method....

This is a pretty straightforward piece of code. Why am I getting this error on line 5 char1?<script type="text/javascript"> function resubmit() { var recip = document.getElementById("web_recip"); var ind=recip.indexof("?resubmit"); if (ind>0){ recip=recip.replace("?resubmit",""); var resub=document.getElementById("resub"); resub.value="Y"; } } </script>  

Calling a method with a class object as parameter data type.

   [WebMethod]    public string GetInfo(Customer inCust)    {        // Code in here    } I have a web service that resides on a remote server. I want to call a public method of theweb service named  "GetInfo". The method is shown above. The web service method expects a class object oftype "Customer". What I did to create a Customer object was to define in my asp.net project my own class named "Customer" which is exactlythe same as the class that belongs to the web service project on the remote server. I then created an instance of Customerand tried to call the web service passing in an object of type customer : my.Service ws = new my.Service(); // Get web service connectionCustomer aCustomer = new Customer();aCustomer.Initialize();ws.GetInfo(aCustomer) // call web service passing in a Customer object The problem is that the compiler gives me the following error: Value of type '_Default.Customer' cannot be converted to 'ws.Class1'. Here Default is refering to my Default.aspx.cs code. Why is this? Do I need to Cast my "aCustomer" class object to a type ofws.Customer ? How do I do that?

Cannot send List inside of Dictionary

List<string> receivers = new List<string>(); foreach (object item in listBoxControl1.SelectedItems) receivers.Add((string)item); Dictionary<string, object> inArgs = new Dictionary<string, object>(); inArgs.Add("Receivers", receivers); inArgs.Add("Sender", client.name); inArgs.Add("Message", memoEdit2.Text); inArgs.Add("IsGuaranteedDelivery", true); inArgs.Add("DataType", TransmitToClientDataType.ChatMessage); if (service != null) service.AddTask("orion_send", inArgs); There is an error with serialization at last string because List<string> object. I tryed to send List<T> object via WCF, it's succesfull. But why there are problems with List<T> included to Dictionary?

Provide object over network on callback method

Hello. I am building a client server video monitoring system. I will have a user (viewer) connect to a web page on a server, pick a camera and see what is going on at the particular location. A general WCF question: How can I access VideoSource custom class object remotely on the server via WCF? Basically, I have a VideoSource and VideoSourcePlayer that work great, when are within one process, but how can I access VideoSource object remotely? An example link would be enough. Thank you.  Max Pavlov http://maxpavlov.com

passing messageContract object to a WCF Service method using Soap - not as a method parameter

i want a web application to create a service reference to my WCF service, insert information to the header of the soap call and call my WCF method. my WCF supports soap operations (also there is an endpoint in the config). i read about MessageContract attribute and declared one in the interface file: [ServiceContract] public interface IBasicService { [OperationContract] [WebGet(UriTemplate = "GetData?value={value}")] // Add support for HTTP GET Requests string GetData(int value); } [MessageContract] public class BasicServiceHeader { [MessageHeader] public string myString; } the implementation of the contract : public class BasicService : IBasicService { public string GetData(int value) { return string.Format("You entered: {0}", value); } } i don't want the BasicServiceHeader to be passed as a parameter of GetData function , i want to keep the function signature as it is (without a BasicServiceHeader parameter) and to extract the BasicServiceHeader inside the function, (just like using soapHeader) can i do that ?

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());

LDAP Authentication against SunOne using getdirectoryentry method of directorysearcher object in Asp

Hi All,
I am authenticating user in following way but it says "unknown username or password" even though I provide correct username and password. I am authenticating against Sunone directory server. Unfortunately as per rquirement I could not bind any user with the direcory except service username and password.

I could not figure out whether this correct way or not. Any help would be appreciated.

DirectoryEntry entry = new DirectoryEntry("LDAP URL");

entry.AuthenticationType = AuthenticationTypes.ServerBind;
entry.Username = "uid=thost,ou=somthing,dc=something,dc=something";
entry.Password = password;
DirectorySearcher search = new DirectorySearcher(entry);

search.Filter = "(uid=" + actualUid + ")";
SearchResult rc = search.FindOne();


DirectoryEntry de = rc.GetDirectoryEntry();
de.Password = actualPassword;
object o = de.NativeObject;

catch (Exception ex)

Method 'Post' of object 'IOWSPostData' failed


I have Microsoft Office 2003 and Microsoft Sharepoint Designer 2007 on the
same machine. I have a problem uploading an excel spreadsheet into WSS 3.0.
I get Method 'Post' of object 'IOWSPostData' failed error. I have followed
this article (http://mindsharpblogs.com/Kathy/archive/2008/03/16/4450.aspx)
but it doesn't resolve the issue.
Pls, advise how can I resolve this.

Thank you in advance!


How to user LoadControl(Type type, object[] para) method?



protected void Page_Load(object sender, EventArgs e)
            // This is NOT working. I dont see user control on page
            Type type = Type.GetType("TestProject.UserControls.Gender");                
            Control uc = Page.LoadControl(type,null);            

            //This is working. I can see user control on page
            Control uc1 =  Page.LoadControl("~/UserControls/Gender.ascx");            

 Im trying to load User Control dynamically using LoadControl(Type type, object[] para) method but its not working. I do not get any exception but i dont see user control render on the page. I have a Default parameterless construction in my user control and i see its get executed when i put break point there. but i dont see user control rendered on my page.

If i use OverLoaded method LoadControl(string VirtualPath) then it works fine.


NewWebPage Method in Client Object Method


I'm trying to create a new web part page using cleint om in SP 2010. is this possible? on SPWeb posting this used to work


<Method ID="Text">
 <SetList Scope="Request">GUID</SetList>
 <SetVar Name="Cmd">NewWebPage</SetVar>
 <SetVar Name="ID">New</SetVar>
 <SetVar Name="Type">[WebPartPage|BasicPage]</SetVar>
 <SetVar Name="WebPartPageTemplate">[1-8]</SetVar>
 <SetVar Name="Overwrite">[true|false]</SetVar>
 <SetVar Name="Title">Text</SetVar>

 I can do a file upload as well but does not see that clean...



CreateDocument method in CMIS Object Service raising the Constraint Violation Exception


HI All,

Below are the code snippet for rasing the above exception like  "The operation violates a Repository- or Object-level constraint defined in the CMIS domain model. "


ObjectServicePortClient objectService = new TestCMISWinApp.ObjectService.ObjectServicePortClient("BasicHttpBinding_IObjectServicePort");

objectService.ClientCredentials.Windows.AllowNtlm =



passing values to object properties of action method parameter


I have an action method that accepts a single parm.

That parm is an object with multiple properties. MVC correctly maps values from the querystring
to properties in the parm object by matching property name to querystring value name. 
Problem is, properties in the action method parm object which are themselves objects with
properties, are not assigned their matching values from the querystring. The class object has a
constructor which accepts a single string parameter.

How do I assign to properties of an action method parameter which are themselves class objects?



                <%: Html.ActionLink("Edit", "ProductMasterEdit", 
                       new { ProdKey=item.ProductKey.Value, 
                       ProductKey = item.ProductKey.Value })%> 

    public ViewResult ProductMasterEdit(ProductMaster Item)

  public partial class ProductMaster

    public ProductKey ProductKey
      get { return new ProductKey(this.ProdKey); }
      set { this.ProdKey = value.Value; }


Microsoft JScript runtime error: Object doesn't support this property or method



When I am updating dropdown of parent window from popup it shows error JScript runtime error. But I can able to clear the dropdown. When I am adding only the problem is occuring. I have pasted the code below

var ddlVendor = window.opener.aspnetForm.document.getElementById('ctl00_DefaultContent_ddlVendor');

//Clears the state combo box contents.

for (var count = ddlVendor.options.length-1; count >-1; count--)


ddlVendor.options[count] =


var stateNodes = listNode.getElementsByTagName('Table1/UserName');

var stateIds = listNode.getElementsByTagName('Table1/Password');

how do you get object array number in a method?


Lets say you have four array objects.

test[1] = new test();

test[2] = new test();

test[3] = new test();

test[4] = new test();

then you have your class:

public class test()


   public int i; //initialize some fields

   public int getnumber()


  // what is the array number of the this object? 1, 2, 3, or 4???



so basically, if an object is called: test[1].getnumber   how can this method internally determine what object array number it is currently in?  (without passing an integer from the page)

  it can be either 1, 2,3, or 4.

Accordion: object doesn't support this property or method


I have simple accordion:

$("#accordion").accordion({ autoHeight: false, active: false });


This causes the Microsoft JScript runtime error: Object doesn't support his property or method.


All other JQuery code works fine. Anyone has any idea why this is causing this error??
thanks in advance.

Action method taking model object



I've an action method like the below:


public void Edit(Movie movie)



Movie has fields Id, Name. View is displaying name only in textbox. When button is clicked, the above action method's movie is populates with the updated name value but Id is 0, actually that record's id is 4. Thatswhy my updating of record is not working. Why MVC is putting 0 into id?


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