.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

confused, already disposed?

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net


in the Selecting event of a linqDataSource control, this works:

protected void lds_aGrid_Selecting(object sender, LinqDataSourceSelectEventArgs e)

            testDataContext dc = new testDataContext();
            IQueryable<Solution> query;

            // check for 'Select All Customers' scenario, the default
            if (lstSelectCustomer.SelectedValue == "Show All Customers")
                query = from s in dc.Solutions
                                orderby s.Customer.Name ascending
                                select s;
                query = from s in dc.Solutions
                                where s.CustomerID == Int32.Parse(lstSelectCustomer.SelectedValue)
                                orderby s.Customer.Name ascending
                                select s;

            // return result
            e.Result = query.ToList();

but this does NOT work:

protected void lds_aGrid_Selecting(object sender, LinqDataSourceSelectEventArgs e)

            using (testDataContext dc = new testDataContext())
                IQueryable<Solution> query;

                // check for 'Select All Custom

View Complete Post

More Related Resource Links

Formview + EditItemTemplate + Bind + PageLoad + Prerender = Confused


I am working with a formview edititemtemplate.  Currently in my page load, i have some stuff that would show or hide certain panels based on dropdownlist values.  These dropdown values get binded during page load.  I need to be able to change the values/dropdowns, without rebinding the old data, and updating the visibility of the panels based on predefined rules.

I have experimented with putting my formview.databind() in page load if isnotpostback, in prerender, in prerender if isnotpostback.   I have tried my rules (ex if ddlState.selectedvalue = "DE" then pnlDelaware.visible = "true") in the page load, and the page render.   I'm just not sure how to get the stars aligned here.

The closest i have come is having the databind in the pageload if notispostback, and the rules in the prerender.   However I get an error "dropdownlist has a SelectedValue which is invalid because it does not exist in the list of items.


Confused about Disk Alignment/ Partition Offset

I am all confused by disk alignment, partiton offset.Why do we need to calcualte offset which most of the articles talk about, This is from White Paper  Disk Partition Alignment Best Practices for SQL Server where its stressed that Partition_Offset ÷ Stripe_Unit_Size-- should be an integer 'The performance question here is usually not one of correlation per the formula, but whether the cluster size is the NTFS default of 4,096 bytes or has been explicitly defined at 64 KB, which is a best practice for SQL Server.' Also how do we calculate Stripe Unit Size for SAN. Thanks all for your replies !!  

Objects not disposed after override style

Hi, I have used a popup in my silverlight control which contains border, Grid, ScrollViewer etc. I will open this popup in some scenarious and i will change the style of the control using another resource dictionary.While changing the style i will OverWrite the existing objects with the current style in OnApplyTemplate(). Now when i open the popup both the old and current styles getting opened. Please guide me on this issue.   Thanks for any help..

Still confused :(


I have downloaded Visual Studio 2010 (Luckily my university provides it for free) andI tried it and it seems to be good. However, my problem is that I am still confused which programming language should I learn for web development regardless the IDE. My options are ASP.NET and PHP.
Sometimes I would like to go with PHP because you do not need to specific IDE to write code and it's cheaper for hosting,etc. And sometimes when I look at the big websites I found most of them use ASP.NET and this increase the confusion for me Cry.
Please as an expert, could you provide me a good advice. (Please be subjective in your advice, remember it's an advice)

Confused about membership provider and what else I need to use..


I am creating some inhouse web applications(MVC2) for our employees to use..

We currently have a separate backend system that stores login information, session ids(which get stored in browser cookies), ect..

I am trying to create a custom membership provider to work with all of this..

I have seen some code samples where people just set a reference to and create an instance of their custom membership provider and then just executing the functions wherever needed (Eg. ValidateUser).. If thats correct then whats the point of inheriting the membership provider class, why not just create your own class to do what you need with your own method names.. Also why does the membership provider need to be referenced in the web.config file if its just a class that is used from the controller????

Is there something im missing here or maybe more that I need to do??

Also is it possible to make my custom membership provider global so that any web application we create will be able to use it without having the library bundled with each application??

Confused about MVVM


I am porting an old WinForms application to WPF and using the MVVM pattern. I have not written any code using this pattern previously. So I am confused and have a fairly basic questsion

In the Old app, I had a MainWindow and many tabs. The tabs all used objects that were defined in the MainWindow. So the functionality of each tab could be applied to these "global" objects and all was good. One tab provided functionality that did a transform on an object. Another provided analysis on the current state of the same object and so on.

Now, with MVVM, I am using a similar UI model - MainWindow with many tabs where each tab has it's own viewModel and view. (don't want to change the UI on the users). My question is - where do I put the "global" objects? My model contains the classes definition for these objects. But where is the instantiation done? in which class?

Am I to create a global model? one that represents the app at runtime?  If so, how does each view/viewModel know to load the right instance of the "global" object so that it can then wrap appropriate parts in ObservableCollections etc?

Am I making sense or should I just get some shut eye tonight and RTFM tomorrow




.NET Framework 4, I'am confused about supported XP editions



according to this msdn entry (http://msdn.microsoft.com/en-us/library/8z6watww.aspx ) .NET Framework 4.0 doesn't support Windows XP Media Center, Starter, Reduced Media and Tablet PC editions, but the official download page says it supports Windows XP SP3.

To my understanding at least the Media Center and Table PC editions are just extended Windows XP Professional versions.

Can someone tell me the truth? Has someone successfully installed .NET Framework 4.0 on any of these XP versions?

Best regards, Cubicle

Getting SPRequest object was not disposed before the end of this thread in SP document library event


I am using a sharepoint event listener attached to a document library to export files when they are added or modified. Here is a partial stack trace from the SP log for the SPRequest object was not disposed:

This SPRequest was allocated at    at Microsoft.SharePoint.Library.SPRequest..ctor()     at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous)     at Microsoft.SharePoint.SPWeb.InitializeSPRequest()     at Microsoft.SharePoint.SPFile.GetFileStream(OpenBinaryFlags openOptions, String etagNotMatch, String& etagNew)     at Microsoft.SharePoint.SPFile.OpenBinary(SPOpenBinaryOptions openOptions)     at Extract.SharePoint.Redaction.IdShieldFileListener.HandleSharePointFileEvent(SPItemEventProperties properties, FileEventType eventType)

Here is basically the code in the HandleSharePointFileEvent:

    public override void ItemUpdated(SPItemEventProperties properties)

ItemUpdating event handler causes SPRequest object was not disposed error if properties.ListItem is


I have a very simple ItemUpdating event handler that is causing an SPRequest object was not disposed error when it is fired. The event handler is linked to the document library. I have cleaned out all of my code and narrowed it down to this:

    public override void ItemUpdating(SPItemEventProperties properties)
      SPListItem item = properties.ListItem;

When I change the name of a file or folder in my document list the following line is logged in the SP log:

An SPRequest object was not disposed before the end of this thread.  To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it.  This object will now be disposed.  Allocation Id: {D7AA6805-4CA1-458B-9252-E83D32DBD0D3}  To determine where this object was allocated, set Microsoft.SharePoint.Administration.SPWebService.ContentService.CollectSPRequestAllocationCallStacks = true.


As an extra note I have actually set the CollectSPRequestAllocationCallStacks to true, this is all the information that it gives me. If I comment out the pr

EMG, MLG, and WIPRO..... Confused and no enough answers on Google Search


Plz i need the What this words means?  All I know MLG is short for Microsoft E-Learning Gateway and these three shorts are somhow linked to SharePoint!!

I know my question is a poor one but I really drawning for this info.


Best Regards,

Mostafa Zayed

EMG, MLG, and WIPRO..... Confused and no enough answers on Google Search


Plz, What this words means EMG,MLG, and WIPRO?  All I know MLG is short for Microsoft E-Learning Gateway and these three shorts are somhow linked to SharePoint or they use SharePoint within thier implementation!!

I know my question is a poor one but I really drawning for this info.


Best Regards,

Mostafa Zayed

System.ObjectDisposedException: Cannot access a disposed object.Object name: 'MQCacheableInfo'.



I am using MSMQ concept in my .Net windows service application. So, i got below mentioned error and messages are moved to UnHandled queue. If i process manually then message has been processed well. So, this issue we got quite common on my production environment. I would like to know whether can we fix this issue.

Exception Message:

2010-10-05 01:37:03,687 [Handler.1] WARN  HandlerService.CWorkerThread - Couldn't process message

System.ObjectDisposedException: Cannot access a disposed object.Object name: 'MQCacheableInfo'.

   at System.Messaging.MessageQueue.MQCacheableInfo.get_WriteHandle()

   at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, IntPtr transaction)

Confused by passing by reference


On the client I want to instantiate an instance of an entity (that has a datacontract on the server side), send it to the server, let the server modify it in some way, and send it back. I'm talking about using standard-issue, ordinary WCF objects with DataContract/DataMember attributes.

The only way I could figure out to accomplish the above is to pass the object by reference.  Is there another way?

In researching this, I found the links below, one of which says it is not possible to pass by ref (yes I realize we are passing a copy, but it is the result I'm interested in.  Perhaps that is what the author is alluding to??).

Sorry for having to ask this but I'm confused (again).




Server code:

Confused about SMTP setup on Server 2008

I can't seem to find the basic SMTP configuration.  How can I configure the basic SMTP services.  The SMTP service is there and the features list shows that SMTP is installed.  I can't find the MMC tool for it.

adam hodge (MSFT) 

Repository Pattern Question. Confused need help.



I been reading Repository Pattern implementation for MVC 2. I am confused due to few things.

Simple Implementation is below.

Tables : Contact has One to Many relation with AssignToCategories
1 - Contacts
2 - AssignToCategories

I have in Model folder


My Questions

1 - We can use ContactRepository directly in View. Why we need IContactRepository for. As long as I know its for Test. Am I right?. If not than whats the purpose.
2 - I have seen ContactService, IContactService. As for as I know its for Business logic. Is there more to it?
3 - Contact has relation to AssignToCategories. Should I put all the data reterival logic within ContactRepository or this AssignToCategories need to have separate Repository and Interface.

I need some help with the concept. Though I have done alot of reading but still confused.

There is one layer called Pipe and filter. Whats the used of that?


Workflow Error ......System.Workflow.Runtime.Hosting.PersistenceException :Cannot access a disposed

I have a workflow that works fine on our development server...However on the production server it gives the exception below....

I have compared the configuration on both the servers and its the same.
I have hard to get around this error...

Can someone help please...

.WorkflowRuntimeService._workflowRuntime_WorkflowTerminated() Workflow ab37dd8b-c642-4a2a-9573-566e54a566cf Terminated: System.Workflow.Runtime.Hosting.PersistenceException: Cannot access a disposed object.
Object name: 'Transaction'. ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Transaction'.
  at System.Transactions.Transaction.Rollback(Exception e)
  at System.Workflow.Runtime.Hosting.WorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)
  at System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)

Confused about TCP packets

I have an application which acts as a server and send bytes from a file to client applications. No matter where I try on almost all machines the calculated speed is around 170k per second. On the client machines the packet size is always 1460, even though I have set my SendBufferSize, Recieve Buffersize to 10000. I feel as if I'm always going to be trapped with this speed regardless of Bandwidth. I have been testing out on Network machines and remotely distance ones. I understand that setting the Buffersize and the Send, receive size has a lot to do with the speed but what does that matter when the maximum I can send is 1460? Please Let me know if I'm Doing anything wrong or if there is more I need to do in order to reach higher speed. I cant imagine sending to a network PC at only 100-200kb per second.
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