.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

Delete object is empty

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

I have a view that gets populated via this code

public ActionResult Delete(int id)
            return View(_availableService.GetAvailable(id));

the view gets populated perfectly.  then i call this code below availableToDelete object is empty.  What is the reason for this?

        public ActionResult Delete(Available availableToDelete)
                // TODO: Add delete logic here
                if (_availableService.DeleteAvailable(availableToDelete))
                    return RedirectToAction("IndexByStaffEmail", new { email = Session["StaffEmail"] });
                    return View(_availableService.GetAvailable(availableToDelete.AvailableID));
                return View();

View Complete Post

More Related Resource Links

How to get nodes based on some values, update other element or delete that whole object



This is my xml string.

<xml version="1.0" encoding="utf-16">
    <x> test value 1 </x>
    <y> test value 2</y>

        <x> test value 3</x>
        <y> test value 4</y>

                <x> test value 5</x>
                <y> test value 6 </y>

                <x> test value 7</x>
                <y> test value 8 </y>

                    <x> test value 9</x>
                    <y> test value 6</y>







I have a big xml same as above containing a deep hierarchy.

Now, I am looking to do two things.

1. I want to find a particular node/obj by checking <x> element value. so I want to get node ofwhich <x> value is "test value 3" and for that object, I want to update <y> value to "Some New Value".

2. I want to find all the nodes/objects by checking <y> element value is "test value 6" OR "test value 8" OR "test value

Delete Document Set if Empty


Hello all,

I am addressing a case management need to delete a document set once the items within the document set have been disposed. Each individual content type within the document set has its own retention, and the overall document set has a separate retention policy. Is there a way to delete the document set once all the items within it are gone? I was thinking about having a calculated field for the number of document set items and then triggering a workflow to delete the document set once the number of documents = 0.

Any thoughts?

Subject: BUG? Empty Business Object when Configure ObjectDataSource


I would like to bind an ObjectDataSource control in my page to a method of 
one of the existing classes in my App_Code folder. However, when I go 
"Configure Data Source..." for this control, the wizard shows an empty 
drop-menu for business object, and I can't choose any of my classes

All my classes in the App_Code compile successfully and I don't understand 
what is causing this problem. Is there a bug?


Unable to delete computer object in AD using .net but able to do so using the console


Hi everyone.

I am having a problem when trying to delete a computer from AD.

I am working on an application to create and delete computer objects in Active Directory

If the application created the computer object, there is no problem deleting it again, but if the computer object is created by another user, I get access denied. And here is where it get realy strange. If I open the Active Directory Users and Computers, with the same account I am using in the application, I can delete it, but I can not delete the object from my application.

I have tried to set the permissions for the object to Full and then it is posible to delete the object, but only if I set the permissions to Full. If I select every permission exept Full, I get Access Denied.

Is there any of you that has seen this behavior before or has and idea to why this is happening?

Any help is appreciated.

This is the function I use for deleting the computer object. strComputer is the ldap path for the computer object. 

Dim objComputer As DirectoryEntry

   objComputer = New DirectoryEntry(strComputer, "domain\username", 

SQL2005 - for xml - an object or column name is missing or empty


Hello - I am attempting to figure out how to output a sql2005 query into xml & starting with this example from the site - http://msdn.microsoft.com/en-us/library/ms345137(v=sql.90).aspx, but running into the error - An object or column name is missing or empty.

Can someone tell me what I'm missing?  Thanks!!

Here is what I have so far:

select campaign_name as ''@Campaign_Name''

(select Campaign_ID as ''@Campaign_ID''

from sfrefunds2

where sfrefunds2.activity_quuid = sfrefunds1.activity_quuid

for xml path ('xmlTest'), type),


(select distinct identifier as ''@Identifier''

from sfrefunds3

join sfrefunds2 on sfrefunds2.activity_quuid = sfrefunds3.activity_quuid

where sfrefunds1.activity_quuid = sfrefunds2.activity_quuid

for xml path('xmlTest2'), type)

from sfrefunds

for xml path('xmlTest1')

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.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

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.

SqlCommand.ExecuteNonQuery() returns -1 when doing Insert / Update / Delete

Sometimes you end up with a return value of -1 when using the SqlClient.SqlCommand.ExecuteNonQuery method.

Why is that?

Well, the ExecuteNonQuery method is there for statements for changing data, ie. DELETE / UPDATE /INSERT, and the returned value are the number of rows affected by that statement.

When checking the documentation we can see that there are some conditions that return -1.

For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of

rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

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?

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.

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