.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

Web Q&A: TextAreas, AutoComplete Dropdown Box, JScript Garbage Collection, Caching, and More

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

More Related Resource Links

Garbage Collection-Part 2: Automatic Memory Management in the Microsoft .NET Framework


The first part of this two-part article explained how the garbage collection algorithm works, how resources can clean up properly when the garbage collector decides to free a resource's memory, and how to force an object to clean up when it is freed. The conclusion of this series explains strong and weak object references that help to manage memory for large objects, as well as object generations and how they improve performance. In addition, the use of methods and properties for controlling garbage collection, resources for monitoring collection performance, and garbage collection for multithreaded applications are covered.

Jeffrey Richter

MSDN Magazine December 2000

Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework


Garbage collection in the Microsoft .NET common language runtime environment completely absolves the developer from tracking memory usage and knowing when to free memory. However, you'll want to understand how it works. Part 1 of this two-part article on .NET garbage collection explains how resources are allocated and managed, then gives a detailed step-by-step description of how the garbage collection algorithm works. Also discussed are the way resources can clean up properly when the garbage collector decides to free a resource's memory and how to force an object to clean up when it is freed.

Jeffrey Richter

MSDN Magazine November 2000

EventListeners and Garbage Collection


If I have a collection of objects that all have a PropertyChanged event (they implement INotifyPropertyChanged).  If I add a listener to the PropertyChanged events for all the objects in that collection, but start removing those objects will I create a memory leak, by not deattaching the listener before removing the object?  I.e. will I prevent garbage collection from happening for those objects or the listeners?

Garbage Collection

I have some understanding of Garbage collection but need some more clarifications. Which all are unmanaged and managed resources? Is database connection an unmanaged resource, if I open a database connection would I be creating an unmanaged resource. What is the difference b.w finalize and dispose. Do I have to call dispose for both managed and unmanaged resources or finalize method for umanaged resources. Setting objects = null, does that mean it clears out the memory allocated to them.   Thanks.

Long running WPF application - Garbage Collection

Hi All, I have a long running WPF application; users start the application and keep it open for at least 6 hours straight. I spend a couple days with a Memory Profiler, solving a couple of memory leaks. According to the Memory Profiler, all is good now. However, when I run the application, and monitor the Memory in the Windows Task Manager, it only seems to grow. When I create a button to force the garbage collection (GC.Collect()), a lot of memory is freed from the app. My questions: 1. I don't feel like it's a good idea to call GC.Collect() explicitly; is there any case where it is advised to do so? 2. Is it normal that it takes WPF that long to start garbage collecting automatically? Thanks, Koen

Set dropdown width of a textbox with AutoComplete in windows forms



I have used a Textbox control along with its AutoComplete feature by using AutoCompleteMode,AutoCompleteSource and AutoCompleteCustomSource properties.

Everything is working fine i.e. on typing letters dropdown list shows the related matching list of values.

However, I am not able to set the size of dropdown list programmatically.  I can increase the size(preferably width) of dropdown list at runtime.  But, as AutoCompleteCustomSource is getting reset everytime the textbox gets focused, dropdown list width also gets reset to the width of the textbox.

Just like the feature of Combo to set DropDownWidth programmatically (or say at design time), is there any way to set dropdown width for a Textbox having AutoComplete feature.

My Code for the reference (On Form Load event) :

        TextBox1.AutoCompleteMode = AutoCompleteMode.Suggest

Speed issues with ReaderWriterLockSlim and Garbage Collection


I have an example piece of code the illustrates issues in my code when GC.Collect is carried out on a class having a ReaderWriterLockSlim member variable. The GC.Collect takes between 2 and 3 seconds to run. I need to carry out GC at regular intervals because my applicaton is extremely memory intensive.

namespace WpfApplication12


 public class DataItem


  private readonly ReaderWriterLockSlim m_propertyLock = new ReaderWriterLockSlim();

  public DataItem()




 /// <summary>

 /// Interaction logic for Window1.xaml

 /// </summary>

 public partial class Window1 : Window


  public Window1()



   List<DataItem> dataItemList = new List<DataItem>();


Garbage collection in this example, true or false?


when using this code:  

string s;
s = "wombat";
s += " kangaroo";
s += " wallaby";
s += " koala";


they tell me: only the last string has a reference, the other three will be disposed of during garbage collection.


So what does this mean exactly?

string s got only the reference of "koala"? or a reference to "wombat"??



how to filtering the autocomplete textbox values while selecting perticuler value in dropdown.


in my applicaion dropdown having country,state ,district  values  and one autocomplete textbox  , if i select country in the dropdown  only country names should be filtering in autocomplete textbox ..........can anybody tell me

thanks in advance


disable Garbage Collection


Plz make me suggestion:

I want to implement logic to garbage collector using c#.net. i.e. want to code to do GC in my own logic. So my Questions are:

1. Where should i write code to do it?

2. If it is c#.Net. how do i disable or restrict .Net Framework to auto collect garbage?


Please advice me for above question.

Dropdown list in ASP.NET - How to get value selected

am sure this must be very simple, but unforunately I can't figure it out.
I have the following code which populates the dropdown lists from the database. This works fine. Now, when the user selects a particular employee name from the list, I want to get the Employee Id of the selected employee. i.e. I need to get the "Eid" value. I can do this if the EId is loaded in the dropdown list, but in this case only the employee name is displayed. Please let me know howI can get the Eid value even though it is not loaded in the dropdown list.
I would really appreciate your help

Editable Gridview with Textbox, CheckBox, Radio Button and DropDown List

This is an example of an editable gridview containing different ASP.NET controls. When user wants to edit values in gridview, she/he can use these controls to edit existing values in Gridview Edit Mode.

Using the Code

Binding an array to dropdown list


I have the following string which is a list of urls. How do I get this to work so the url shows for the selection and also is the value?      


allLinks = newAllLinks
        Me.DropDownList1.DataTextField = "Link"
        Me.DropDownList1.DataValueField = "LinkURL"
        Me.DropDownList1.Items.Insert(0, New ListItem(" - Select - ", 0))
        Me.DropDownList1.DataSource = allLinks


 ArgumentNullException: Value cannot be null.
Parameter name: container]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +121
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName, String format) +8

jquery autocomplete multiple values


i got some samples and i did autocomplete using jquery , its working well for single input values

but i need to pass multiples values after one by one in the textbox. Is it possible to pass multiple

values in the textbox for autocomplete in jquery in asp.net?


ASP.Net Caching problem ??


I'm having a problem with an asp.net 3.0 application using a gridview to display data.  The problem seems to be that despite a brand new .selectCommand being sent to the sqlDataSource, the gridview starts displaying data from *someone else's* query.  For example, user A is logged in and will be working fine until a few page submissions later when the gridview data starts suddenly showing information that belongs to another user. 

This is my first asp.net application, though I've been working with classic asp and ADO for years so I'm used to sending a SQL string and getting back the results from that string.  Apparently there is a complex caching system which is interferring which I do not at all understand so at this point I just want to stop the server from caching any data whatsoever.  Is this possible?

Any and all help will be much appreciated!!

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