.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

arguments null in onSuccess method

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
HiI'm trying to validate user input into a textbox via a web service.I'm using a Dynamic Data site, with a custom Dynamic Data field to show this particular value. In the dynamic data field I've added a custom validator - <asp:CustomValidator id="CustomValidator1" runat="server"        ErrorMessage="Invalid Item ID!"      ControlToValidate="TextBox1"      OnServerValidate="ServerValidate"      ClientValidationFunction="validateItem"     /><asp:CustomValidator id="CustomValidator1" runat="server" ErrorMessage="Invalid Item ID!" ControlToValidate="TextBox1" OnServerValidate="ServerValidate" ClientValidationFunction="validateItem" />In a custom page, I have the following Javascript - <script type="text/javascript"> <!-- function validateItem(source, arguments) { InventTableService.exists(arguments.Value, onComplete, onError); } function onComplete(source, arguments) { alert(source); arguments.IsValid = source; }

View Complete Post

More Related Resource Links

The best overloaded method match for... has some invalid arguments

I have a compilation error generated by this scenario: i have : 1. DataAccessLayses 2. Entity 3. PresentationLayer(web application)4. BankServices(web service) inside the webservice i have one web method with argument of my pre-defined class library it name is CustomerEL and the class in PresentationLayer calling the webservice method ,CustomerEL cusE = new CustomerEL();objsv.addCustomer(cusE);(addCustomer(<argument>) is method in BankServices)  and here the eror occuredcan you help me !Regards

No overload for method 'Delete' takes 3 arguments



[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Delete, true)]
     public bool DeleteProduct(int original_ID, string original_Priimek)


    Guid original_UserId = Guid.NewGuid();

    int rowsAffected = Adapter.Delete(original_ID, original_UserId, original_Priimek);

   // Return true if precisely one row was deleted, otherwise false
   return rowsAffected == 1;

string original_Priimek - not found

Please help

GetUserProfileByName method in userprofileservice.asmx returns null values when used in Service Refe


I'm using Silverlight 4 to call GetUserProfileByName method of the SharePoint 2007 userprofileservice.asmx web service. For each of the PropertyData in the e.Result object that is returned, the Values array is null.

Below is the Completed event handler. Execution gets inside the if block for each of the PropertyData.


void client_GetUserProfileByNameCompleted(object sender, GetUserProfileByNameCompletedEventArgs e)
 foreach (PropertyData prop in e.Result)
  if (prop.Values == null) // this is ALWAYS true for each prop


After some investigation, I've found out this only happens when userprofileservice.asmx is added as a Service Reference. I tested this out by creating an ASP.NET project. In it I added userprofileservice.asmx as a Web Reference, and then as a Service Reference. For the Web Reference case,

How can I pass a NULL value as [in,out] argument to a COM method using late binding?


Suppose I have the following method in a COM interface defined in a C++ IDL:

[id(8)] HRESULT MyMethod([in,out,defaultvalue(NULL)] LONG* value, [out, retval] BSTR* returnValue);

Now I want to call this method passing in NULL for the 'value' parameter using late binding in C#. How can this be accomplished?

The following works if I want to pass a non-null argument as value:

         Type type = Type.GetTypeFromCLSID(new Guid("{7DA7BD6A-3E11-4E6B-BDE3-7C968A085F94}"));
         object instance = Activator.CreateInstance(type);

         object[] arguments = new object[] { 101 };

         ParameterModifier modifier = new ParameterModifier(1);

         modifier[0] = true;

         type.InvokeMember("[DispID=8]", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null, instance, arguments, new ParameterModifier[] { modifier }, null, null);

         Console.WriteLine("Value after call: {0}", arguments[0]);

But how can I pass NULL? Using 'null' or Type.Missing give me type

On clicking a button, call a method with extra arguments


I have a small question about Button.Click events, namely how can I call a method with some extra arguments?

My code is this:

btn.Click += new RoutedEventHandler(Method);

But I would really like it to be of the following form:

btn.Click += new RoutedEventHandler(Method(x));

That is, having an extra argument. However, this does not work.

How can I create something that has the desired operation?

How to marshal safearray arguments when calling managed C# method from unmanaged C++?


I'm trying to utilize an old application framework from managed C# code but I don't understand how to marshal the safearray argument which is forwarded to the managed code. Here is a code snipped describing how the managed code is called:

  try {
    _ObjectHandlePtr pObjectHandle; 
    _ObjectPtr pObject; 
    _TypePtr pType;
    SAFEARRAY* psa;

    // Create an instance of a type from an assembly
    pObjectHandle = pDefaultDomain->CreateInstanceFrom(L"ClassLibrary1.dll",   // no path -- local directory
    variant_t vtobj = pObjectHandle->Unwrap();                   // Get an _Object (as variant) from the _ObjectHandle
    vtobj.pdispVal->QueryInterface(__uuidof(_Object),(void**)&pObject); // QI the variant for the Object iface
    pType = pObject->GetType();                             // Get the _Type iface
    psa = SafeArrayCreateVector(VT_VARIANT,0,1);               // Create 

Compiler Error Message: CS1501: No overload for method 'EndExecuteNonQuery' takes '0' arguments



I have a page that add and edit news. and 2 class file


public class PageDataAccess:Page
    protected DataAccess DA=new DataAccess();

    protected void Page_UnLoad(object sender, EventArgs e)


public class DataAccess
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MisrNewsConn"].ToString());
    public DataAccess()
		// TODO: Add constructor logic here
    public void DataClose()
    public int addEditNews(string Nid,string title, string summary, string detail, string cid, bool Ishome, bool IsMain, byte[] image)
        SqlCommand cmd = new SqlCommand("StoredProcedure1", conn);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@IsMain", IsMain);

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.

Sys.Net.WebServiceFailedException: The server method '' failed with the following error:



Let's say we have 2 time consuming functions, aaa and aaa1 inside a aspx page.

        public static string aaa(int i)
            return i.ToString();

        public static string aaa1(int i)
            return i.ToString();



        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        <span id="displayspan"></span>
        <br />
        <input type="button" value=

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

How to check for null/empty strings on dynamic objects?


What is the proper way to check for null or empty strings on dynamic objects? This is the only solution I've found so far:

if (admin.PasswordHash.GetType() == typeof(DBNull) || admin.PasswordHash == string.Empty)

If the field is null, the object returned is DBNull.Value, but if the field is empty string, it's return as a System.String object. This makes it impossible to do regular "admin.PasswordHash == DBNull.Value" check, as that will fail whenever the field has been set to empty string. Is my example the right (and only) way to go?

Using CreateNewUserWizard SendingMail method to email me, not applicatnt.


I have staff area of my site I am protecting with forms authentication using c# and .Net 4.0. What I want to do is let the staff members register on the site but instead of the confermation email being sent to them I want it sent to me so I can go in and approve it. I have been trying to use the SendingMail method  but can not figure out how to get it to email me instead of the person that registered. I have searched around this site and find many topics on the SendingMail method but none seem to properly address my issue. Can anyone help me out?

Users getting logged out because HttpContext.Current is null


We've  been trying to fix this one for a couple years, and I'm just out of ideas, so any help is really appreciated!

We've got a fairly large, complex web application that uses Forms Authentication to authenticate users.  Throughout the application we store and retrieve information about users in the Session object, and in some cases in cookies.  In a couple places we check for the existence of the context, and if it's null we send the user back to the login page to re-establish the session. 

Just a quick run-down of this web app: C#, .NET 3.5, IIS 6, ASP.NET State Service to manage session

As for the session timer, we use our own home-grown timer, which is basically a client-side timer, which is backed up by a check to the SQL database to see when their last activity was.  This seems to work well for us.  It's not perfect, but it allows us to notify the user before the session times out, and allows us to be certain we're not logging a user out before their 60 minutes of inactivity is up.

What's happening is that certain users are being logged out after just a few minutes.  We've eliminated the timer as a cause and believe what's happening is the HttpContext.Current is null, so the user is logged out.  We do not know why the HttpContext.Current is null, and I underst

statement cannot appear outside of a method body


hi all,

  i am posting my vb.net problem .plz tell me how to resolve this :-

Dim conn As String = ConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString
    'Dim mysqlconnection As New SqlConnection(conn)
    'If mysqlconnection.State=ConnectionState.closed Then mysqlconnection.Open();
    'Dim mySqlcommand As New SqlCommand("select CategoryId,CategoryName from Categories", mysqlconnection)
    'Dim mySqlDataAdapter As New SqlDataAdapter(mySqlcommand)
    'Dim mydataSet As New DataSet()

    'if mysqlconnection.State=ConnectionState.closed Then mysqlconnection.Open();

i m getting 5 errors in this code

declaration expected in mySqlDataAdapter.Fill method; Gridview1.DataSource=ds; Gridview1.DataBind();

Question in Get method in C#


I got a recent working code from client.I see errors in the get methods when i compile , below are some place where the error happens.Can any one help me out?


Error 2 'System.Environment.NewLine.get': cannot explicitly call operator or accessor C:\Documents and Settings\shankar\My Documents\Visual Studio 2008\Projects\DKCLwin\DKCLwin\LocalizationAdmin.cs 150 170 DKCLwin

Error 2 'System.Environment.NewLine.get': cannot explicitly call operator or accessor C:\Documents and Settings\shankar\My Documents\Visual Studio 2008\Projects\DKCLwin\DKCLwin\LocalizationAdmin.cs 150 170

'element.className' is null or not an object



I just downloaded the project, compiled it and ran it right out of the box and when I put the mouse pointer over or remove the mouse pointer from either MenuItem in the menu demo, I generate this error:

'element.className' is null or not an object

It points to this javascript method:

updateClassName: function(operation, element, name, value) {
        this[operation + 'String'](
                function() {
                    return element.className;
                function(newValue) {
                    element.className = newValue;

.NET Matters: Restart Manager and Generic Method Compilation


This month Stephen Toub answers questions pertaining to the Windows Vista Restart Manager API and generic method compilation.

Stephen Toub

MSDN Magazine April 2007

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