Archive for Uncategorized

Detect ‘Enter’ key and press desired button – for all browsers

We all need to set a default button on an asp.net page. There are few options too but with some limitations. As for e.g. we have an option to call click method of javascript and another option is set DefaultButton property of an asp.net panel but both would not work in firefox. To run default button or call any button on enter key will work as below:

<asp:TextBox ID=”txtUserLogon” runat=”server” Style=”display: none” ValidationGroup=”SearchUser”
onkeypress=”searchKeyPress(event);”></asp:TextBox>

function searchKeyPress(e)
{
if (window.event) { e = window.event; }
if (e.keyCode == 13) {
var b = document.getElementById(‘<%= lnkSearch.ClientID %>’);
if (b && typeof (b.click) == ‘undefined’) {
b.click = function() {
var result = true;
if (b.onclick) result = b.onclick();
if (typeof (result) == ‘undefined’ || result) {
eval(b.getAttribute(‘href’));
}
}
}
}
}

Help from: http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/

Leave a Comment

Add Tooltip to ListBox Control in ASP.NET

I was trying add a title or horizontal scroll bar to one of my asp.net listbox control. This is required because few of my list item text was lengthy. Finally I got solution.

foreach (ListItem item in lstSourceList.Items)
{
item.Attributes.Add(“title”, item.Text);
}

Comments (2)

Optimize your Visual Studio 2005 IDE

  1. Go to Tools | Options.In Environment | Startup section, change At startup setting to Show empty environment.
  2. Disable splash screen. Add the parameter /nosplash to the Visual Studio 2005 .exe target.
  3. Turn off animation. Go to Tools | Options | Environment and uncheck Animate environment tools.

Leave a Comment

How to know which framework version is installed ?

Search for MSCorEE.dll file in the %SystemRoot%\system32 directory. If exists that means framework is installed. Now if you wanna know which framework version is installed, simply write “clrver” command in visual studio command prompt. It will list out all versions installed in your system.

Leave a Comment

Refactor 2.2 for ASP.NET

Refactor! is freely available to all ASP.NET 2.0 developers and offers a comprehensive suite of tools that enable you and your team to simplify and shape complex code and HTML markup – making your web applications easier to read and less costly to maintain.

Demo Images : http://www.doitwith.net/2007/05/07/PowerfulFreeDownloadRefactor!ForASP.NET2.2.aspx

Leave a Comment

Multithreading in ASP.NET

Multithreading is a technique that can be used to perform time consuming tasks in a separate additional thread other than the main application thread.  Each time a thread is created, a certain amount of memory is consumed to hold this thread context information. Hence, the number of threads that can be created is limited by the amount of available memory.

Instead of creating a thread each time we need one, and then destroying it after finishing, the .NET framework introduces the concept of thread pool. In the thread pool technique, and instead of creating a new thread whenever you need one, your application will obtain a thread from the thread pool. After that obtained thread completes its task, it will be returned to the thread pool instead of destroying it – waiting for the next acquiring. This reusability increases the overall application performance, and reduces the cost of excessive thread creation and termination.

To make use of this technique, you need to use the System.Threading.ThreadPool class. The thread pool will be created the first time you use it. The number of total threads in this pool is restricted by default to 25 threads. This means that all of these 25 threads may be busy at some point. If you need to acquire a new thread at this point, your task will be scheduled waiting for a thread to finish its task and return to the pool.

http://www.beansoftware.com/ASP.NET-Tutorials/Multithreading-Thread-Pool.aspx

Comments (5)