.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

AsyncFileUpload --> OnClientUploadStarted --> args.set_cancel(true); --> Object doesn'

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net


I am using the AsyncFileUpload. 

I set the  OnClientUploadStarted event to cancel when the file extension doesn't fit using "args.set_cancel(true);"

But I get the following error "Object doesn't support this method"


Bellow the code  


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>

    <form id="form1" runat="server">
        <script type = "text/javascript">  

            function UploadStarted(sender, args)
                var filename = args.get_fileName();  
                var filext = filename.substring(filename.lastIndexOf(".") + 1);  
                if (filext == "txt" )
                    return true;  
                    //upload cancel  
                    alert('upload cancelled');
                   return false;  
            function UploadError(sender, args) 
            document.getElementById('<%=LabelError.ClientID%>').innerText = args.get_errorMessage();

View Complete Post

More Related Resource Links

Ajax Asyncfileupload doesn't work as soon as I put it in a control


Hi guys,

I can't get my <ajax:asyncfileupload> working and I don't see why...

When outside any panel or table it is working well, but as soon as I put it in a <asp:panel> or table I get a strange error which seems to be on client-side but I don't understand what's happen here. Here is the code and code-behind and Javascript.

Here's the error: 


Here's my front-code:

<%@ Page Language="VB" MasterPageFile="~/masterpages/mpSqueletton.master" AutoEventWireup="false" CodeFile="frmAdmGestSocietes.aspx.vb" Inherits="adm_frmAdmGestSocietes" title="Untitled Page" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" Runat="Server">
<script type="text/javascript" language="javascript">    
        function uploadError(sender,args)
          document.getElementById("<%= lblStatus.ClientID %>").innerText = args.get_fileName(), "<span style='color:red;'>" + args.get_errorMes

Menu doesn't popup when WIndow style set to AllowsTransparency="True" WindowStyle="None"

Hi,I'm facing an issue, when using Window style set to AllowsTransparency="True" WindowStyle="None", my menus in menubar doesn't popup, rather they gets hidden (not visible) and if you just click by guess then menu item will be executed, its just that menu item is not shown visisble.However, if I revert back the Window style to normal without Transparency then menus visible(popup) perfectly.I'm not sure what could be an issue?San

Asyncfileupload doesn't work in webusercontrol

I'm having a problem with a Webusercontrol that has an asyncfileupload control. My websusercontrol is being loaded in a placeholder control that's wrapped by an updatepanel.Due to asyncpostback, I have to load and clear the placeholder's controls. The webusercontrol works flawlessly, except the asyncfileupload, which doesn't want to upload at all. I can assure that the code is without error, because I used to have the webusercontrol running as an *.aspx site. I guess that the problem is the fact that the control has to be cleared and reloaded with every asyncpostback ?

Preserving object references in WCF/IsReference=true

Hi I want to be able to preserve references between objects.  I know I can set [DataContract(IsReference=true)] on the class declaration. I want to apply this behaviour to all classes (and we have a lot). I would prefer to just turn it on in one place (as opposed to setting it on each class).  Is there a way to do this? Many thanks. Paul. (Am using .NET Framework 4)

AsyncFileUpload doesn't display in ModalPopupExtender


As far as I can see, the following code should make an AsyncFileUpload display in ModalPopupExtender. The MPE shows fine but the AsyncFileUpload doesn't load inside it. Please let me know if you see anything amiss. I also tried removing the update panel and putting the divs both inside and outside of the update panel, all with the same (lack of) results. And the AsyncFileUpload displays and works outside of the MPE.

In ListView EditItemTemplate:

<asp:UpdatePanel ID="udpUpload" UpdateMode="Conditional" runat="server">
        <div class="profile-with-border">
            <asp:Button ID="btnUpload" Font-Bold="False" TabIndex="160" Text="Upload/Change Photo"
                OnClick="btnUpload_Click" UseSubmitBehavior="False" runat="server" />
            <br />
            <atk:ModalPopupExtender ID="mpeUpload" BackgroundCssClass="modalBackground" DropShadow="true"
                OkControlID="btnOK" CancelControlID="btnClose" PopupControlID="pnlPopup" TargetControlID="btnUpload"
                OnOkScript="mpeUpload_OK" runat="server" />

page inside update panel doesn't refresh the session object after postback of any control



I have many controls like dropdown, radiobuttonlist, etc on my page and I put all these controls inside the update panel so that the page doesn't look to be posting back when something is selected. Now the working on the page is very smooth. But the session object isn't getting refreshed even if I postback to the server and as a result even if the users are working on the page they are being sent to the login screen after 20 mins.

Is there anyway where I could put all the controls in update panel and still refresh the session after any postback(dropdown selection)

Any help is greatly appreciated.

Thanks in advance

ECMA Script ClientContext.ExecuteQueryAsync() give error "Object doesn't support this property or m


I am using SP2010 Client Object Model to perform some operation on sharepoint list. I added SP.js scriptlink to my sitedefination master page and write down some clientside script using client object model. But on ExecuteQueryAsync() i get error "Object doesn't support this property or method".

My Client code is as follow:


 function retrieveWebSite()

    if(SP.ClientContext!=null && SP.ClientContext!=undefined)
     alert('Current Client Context is searching');
     context = new SP.ClientContext.get_current();
     if(context !=null && context!=undefined ){
      alert('Current Client Context is found');
     web  = context.get_web();

        context.executeQueryAsync(Function.createDelegate(this,this.OnSuccess),Function.createdDelegate(this,this.OnFail)); //Here error occurred.

     function OnSuccess(sender,args){
     // alert('Web Title:' + web.get_title() + '\n ID:' + web.get_id() + '\n Created Date:' + web.get_created());

     function OnFail(sender,args){
     //alert('Fail to get list list. Error :'+ args.get_message());

Complete error message is :

Webpage error details

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

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.

Group By With Collapse="TRUE" doesn't show list item.


I created a SharePoint Page.  I then inserted an XsltListViewWebPart web part via SharePoint Designer 2010.  I then modified the CAML to include a couple of filters.  I then added a start date and end date parameter.  Then I saved my page and went into SharePoint.  I added two date filters (start date and end date) and I connected them to the  XsltListViewWebPart web part.  Then I selected a start date and end date and the list is correctly filtered.  The list is grouped by district and location.  However, when I expand the district and then I expand the location, it says "Loading...." but then it never loads anything.  If I change it to Collapse="FALSE" everything works fine???  Any help would be greatly appreciated.




         <FieldRef Name="Created"/>
         <Value Type="DateTime">{StartDate}</Value>

SOAP Client doesn't populate result object


When consuming a remote service XYZ ... XYZ_RESP = client.GET_XYZ_SERVICE(XYZ_REQUEST), the response object is set to null.  Using system.diagnostics, I can see that the results are being returned to .NET in the HttpWebResponse.


I have tried modifying the xsd as described by this link without success:




<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns="http://www.example.org" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/Enterprise/HCM/services" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="XYZ_RESP">
      <xsd:sequence maxOccurs="1">
        <xsd:element name="LOVS">
              <xsd:element name="LOV">

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.
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