| Swaps's profileSwaps BlogPhotosBlog | Help |
|
|
July 26 Tab Key in Web ApplicationsTab Key in ASP.NET Applications To make your Web application more efficient and easier to use, you need to remove any difficulty in web form navigation that your user could experience. User interface and web site navigation must be logical, easy to use and if possible: already well-known from other applications. Off course, nobody wants to learn some new complicated and unnecessary things and crawl through a large help files. Users wants self-explanatory interface that they can start to use immediately. One of common standards is using a keyboard TAB key to move focus forward (or Tab + Shift key to move focus back) between controls on form, instead of forcing your Web site visitor to use a mouse click for changing a focus. Off course, your visitor still CAN use a mouse to set focus in the some text box, but many of them, and they are usually experienced and expert users will more like to use a keyboard only, because it is faster and more efficient way. Tab order in web form So, you need to define a logical navigation through a web form using a Tab key. There is a TabIndex property of server controls. First control in form should lowest TabIndex. With every next tab, focus will move to the control with next higher TabIndex. It is pretty simple to set tab order, you need only to care about few common problems: Problem 1: When we run the page, we can see there is no control with focus when web page is loaded. Much better solution is to have a focus on the right place immediately after page is shown. One solution, which shows how you can set a focus to textbox named txtFirstName, when page is loaded, could be a code like this: Page.RegisterStartupScript("SetInitialFocus", _ Problem 2: Focus moves through a web form, but also goes to Web browser address bar, Google or Yahoo toolbar etc. It is more expected that focus should move only inside the web form, instead to goes to browser address bar. Let say the last focus in on the button named "btnOK" and we want when user press tab key, move focus to the first textbox "txtFirstName" and skip browser toolbars, address bars and other distraction things. You can do it with next piece of code: btnOK.Attributes.Add("onkeydown", _ You don't want to move a focus to specific control?For some reason, you don't want to some control receive a focus. That could be a case if, for example you have an invisible text box or some search text box on top of the web page, but you want to allow tab functionality only to few main controls on the web form. Simply set TabIndex property of server control, or tabindex attribute of HTML control to -1. When you run web page and hit tab key, controls with TabIndex = -1 will never get a focus. Although, user can click into this control with a mouse and set focus on that way. How to type TAB key in textbox or textareaSometimes, you don't need to move cursor to the next control when hit Tab key. What if you need to type Tab character into text box or text area as a part of the text? Off course, your user can type tab in Notepad or some other text editor and simply do copy/paste to your form, but it is not so elegant solution for your Web application :). Instead of that, you can use script like this (in text box named txtLongText): txtLongText.Attributes.Add("onkeydown", _ Or better, to avoid hard coding, you can put this code to function named EnableTabType. Function has only one parameter, which specifies what is TextBox control where you need to enable typing of Tab characters. Public Sub EnableTabType(tb As TextBox) Tab key endnoteDefault value of TextBox AutoPostBack property is false. If you set it to true and if text in TextBox control is changed, tab key will cause form to submit. After submiting, it is possible to loose a focus on current control, especially if you used javascript on page load to set focus initially. In that specific case, you can register client script dynamically and only if Page.IsPostBack value is false. Swapnil (Swaps) http://swapsnet.spaces.live.com/
July 04 Assembly Linker Tool (Al.exe)Assembly Linker (al.exe) To create an assembly from the two compiled modules, you have to use a tool called "Assembly Linker (AL.EXE)". The assembly linker is used to generate an assembly manifest file given one or more files that are either modules or resources files. The output file will contain the assembly manifest which contains reference information for all needed modules or resources. In this case, the manifest can act as the executable for the application. Assume that "Module1.vb" contains a class called "Class1", and this class has a "Main" method as the entry point. To create a multi file assembly from the above two compiled modules using the assembly linker tool, write the following command line: <st1:State w:st="on"><st1:place w:st="on">AL</st1:place></st1:State> module1.netmodule module2.netmodule /main:Class1.Main /out:MAssembly.exe /target:exe
As you can see in the above command line, you first list all of your compiled modules included in the assembly. The /main: option specifies the method name that is the entry point of the assembly (which is obviously the entry point of the final executable as well). The /out: option specifies the output file name which will contain the assembly's manifest. The /target: option specifies the type of the assembly. You can choose from console application executable (EXE), windows application executable (WIN), or a library (DLL). The Various options used along with al.exe are mentioned below. The most frequently used options are mentioned below. 1) /copy[right]:<text> Copyright message Swapnil (swaps) July 03 Parse HTML using ASP.NETHi Again..
If you want to Parse HTML using .NET Framework Assembly, here's the article
Swapnil (swaps)
Dynamically Creating the Control ASP.NETFolks,
I spent some time before I found a pattern to work with dynamically created controls in ASP.NET that satisfied my requirements. I tried multiple approaches and faced multiple problems. If you'd like to avoid getting into the same problems I got, learn about them here first.
Check out this Link
Swapnil (swaps)
June 25 Compiling Multiple Projects Without SolutionCompiling Multiple Projects Without Solution
Automating your build process is very important. An automated build process can detect new issues in a timely manner which means there is a lot less code to have to look at to figure out why it broke. However, it can be time consuming to put together a build process and, if it's not automated enough, can become a source of bugs as well.
So what do you do if you have more projects in your application that can reasonably be put into a solution? How do you run your automated build? Wouldn't it be nice to be able to just point to a directory and compile all of the projects under it in the correct order based on the dependencies already defined in your projects? The source that is included with this article will do this! Just give it a root directory or text file and it will build an MSBuild project that you can use to compile your projects in the correct order. Check out this link to Download and Detailed information about the Article
Swapnil (swaps)
June 19 ASP.NET Internals - Bridge between ISAPI & Applications DomainsFolks,
In this article describe's the bridge between managed and unmanaged worlds and how the two collaborate to set up the processing environment needed by ASP.NET requests to be processed.
Click on this link and scroll below to read complete article.
Swapnil (swaps)
June 04 Client Side Script Debugging in ASP.NETFolks,
Every one of us is well aware of problems posed when debugging client side script code. This article talks about various new techniques and troubleshooting tips that help debug client side script code efficiently in Visual studio 2005. Check out the following Link. http://www.beansoftware.com/ASP.NET-Tutorials/Client-Script-Debugging.aspx Swapnil (Swaps) http://swapsnet.spaces.live.com/
May 29 Gmail Like Loading IndicatorFolks,
Would like to share wonderfull article on Hot to make a Gmail Like Loading Indicator in you ASP.NET page with the help of Ajax. Find the below like which covers the complete article and download the source code for the same
Swapnil (Swaps)
May 28 Downloading a File with Save as Dialog in ASP.NETFolks,
This seems to be a common question that we hear frequently: How do I download a file from a Web site, but instead of displaying it in the browser see it as a file that can be saved (ie. see the Save As dialog)?
Normally when you link a file that file will always display inside of the browser because the browser loads it and automatically determines the content type based on the file extension. So when you click on a link like a jpg image the browser knows it's an image and will display that image. You can of course always use the browser short cut menu and use the Save Target As option to save the file to disk. If you want to do this automatically when a link is clicked from the server side, you have to send the file back yourself rather and add a couple of custom headers to the output. The way to do this is to use Response.Transmit() to explicitly send the file from your ASP.NET application and then add the Content Type and Content-Disposition headers. Check out this link for futher details and code snippet. Swapnil (Swaps)
May 15 Performance Tuning TipsFolks,
Any programming model has its common performance pitfalls, and ASP.NET is no exception. This section describes some of the ways in which you can avoid performance bottlenecks in your code.
Swapnil (Swaps)
May 14 What ASP.NET Developers should know about JavascriptFolks,
This article approaches JavaScript from the perspective of an ASP.NET developer who is comfortable with the paradigms and patterns of either C# or Visual Basic. The article doesn't look at how to use JavaScript from ASP.NET exactly, but it does look at why JavaScript is so different from the two languages we commonly use with the .NET CLR. The article assumes you already know that JavaScript is a loosely-typed language (because you don't have to declare the type of data you store in a variable), and that the syntax is similar to the C family of languages (with charming curly braces and stunningly beautiful semi-colons).
Check out this link for details.
This article is by K. Scott Allen
Swapnil (Swaps)
May 02 SmartCode - An Open Source Code GeneratorFolks,
SmartCode is a template-driven code generator that lets software developers automatically produce programs and components that interact with database system.
Check the Link Below to download.
Swapnil (Swaps)
April 26 Class Diagram Tool - Good Example of ReflectionFolks,
Find the below link which contains the Class Diagram tool. It takes any dll as Input and generates Class Diagram, displayin all the Properties, Methods, Functions, Interfaces present in the class using System.Reflection.
Swapnil (Swaps)
April 25 Multi Select Dropdown ListFolks,
The Dropdown list in ASP.NET is used to select a single item from the list. The Listbox control is used to select multiple items, but it takes up more space on the page. An ASP.NET page which contain many of these controls may make it difficult to find the proper space and alignment for each control.
To overcome this, can use Multi Select Dropdown list box control. It is a user control and can be used directly on pages very easily. It allows the user to select multiple items from the list and the selected items will be displayed in comma separated format in the text area, and it can also persist the selected items. Check out this Link
Swapnil (Swaps)
April 19 101 Visual Basic and C# Code SamplesFolks,
This download includes a master set of Visual Basic and Visual C# code samples demonstrating various aspects of the language in the following areas: syntax, data access, Windows Forms, Web development and Web services, XML, security, the .NET Framework, file system and file I/O, interop and migration issues, COM+, ADO.NET, and advanced topics including graphics with GDI+, remoting, serialization, MSMQ, and Windows services.
Swapnil (Swaps) ASP.NET ToolboxFolks,
Here are listed some of the existing companion tools for .NET development, access the following site to view more details and download the components http://sharptoolbox.com/categories/asp-net
Swapnil (Swaps)
April 18 Automatic Login , How to build application that automatically fill login formsGreetings Folks, Every one of us have accounts in different web sites: Email, Banks, Forums, etc… The most annoying part is the need to remember all the user names and passwords. There are some commercial products that provide a way to save this login information and automatically fill the forms whenever a web site is navigated. In this article it has been demonstrated how it is possible to create your own application that will do exactly this: Remember all the usernames and passwords for you and do a single sign on . Base on what is show here, everyone with some .NET knowledge can build a simple WebBrowser dedicated to such sites. For detailed explanation, Check the link http://www.codeproject.com/useritems/Automatic_Login.asp Swapnil (Swaps) April 11 Can not store 2D array in viewstate
ViewState corresponds to a hidden HTML form field in the WebForm interface. Only string data can be stored there. Since Serialized data is string data it can be stored in ViewState, but As to Arrays, they do not implement iSerializable. Since Arrays cannot be stored in ViewState Instead use, Session State is memory. You can store anything there. Have a look at below article to understand View State
http://msdn2.microsoft.com/en-us/library/ms972427.aspx Rgds, Swapnil (Swaps) |
|
|