Tuesday, February 20, 2007

Implementing AJAX is easy now

With ASP.NET AJAX v1.0 Released, implementing AJAX is easy....

No need to write heavy javascript and plumbing stuff, it is as easy as dragging a control and start doing complex ajax.

Community has provided lots of control toolkit which will help to go ahead...

AJAX ASP.net Weblink : http://ajax.asp.net

Downloading and Installing AJAX Essential Components
1. ASP.NET 2.0 AJAX Extensions 1.0 : http://go.microsoft.com/fwlink/?LinkID=77296
2. ASP.NET AJAX Control Toolkit : http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=AtlasControlToolkit

View how AJAX Toolkit work : http://ajax.asp.net/ajaxtoolkit/

Downloading Video Tutorials : http://ajax.asp.net/documentation/default.aspx?tabid=47

For getting started within no time
1. Get Started with ASP.NET AJAX : http://www.asp.net/learn/videos/view.aspx?tabid=63&id=75
2. Get Started with the ASP.NET AJAX Control Toolkit : http://www.asp.net/learn/videos/view.aspx?tabid=63&id=76
3 Add ASP.NET AJAX Features to an Existing Web Application : http://www.asp.net/learn/videos/view.aspx?tabid=63&id=81

All the video tutors are excellent, and go through all to master the concept.

Monday, February 19, 2007

Performing Code Analysis with Microsoft Visual Studio Team Systeam

Performing Code Analysis with Microsoft Visual Studio Team Systeam

Advantage of Performing Code Analysis

The Managed Code Analysis tool provides warnings that are meant to improve managed code libraries in areas such as design, localization, performance, and security. Each warning signifies a violation of a Managed Code Analysis rule. This section provides in-depth discussions and examples for each of the Managed Code Analysis warnings. The information shown in the following table is provided in the rule topic associated with each warning.

It helps in
1 stability of application
2 Improves Performance
3 Ease of Maintainance
4 More Secure
5 Follows a common naming convention for easy of understanding and gives a professional approach for application
And much more...

Explore more @ http://msdn2.microsoft.com/en-us/library/ee1hzekz(VS.80).aspx

Sunday, February 18, 2007

Ease of applying Globalization and Localization with ASP.net 2.0

I had previously written, an article explaining Localization and Globalization concept in asp.net 1.3, but with asp.net 2.0 the same generalize concept of localization and globalization can be implemented more easily.

I would suggest reader to read the previous article which help you to identify the ease of applying the concept.

Understanding concept with Example
Step1: Create a Web Project.

Step2: Design your form.
For this example : Take 5 label controls, 4 textbox controls and 1 drop-down list control.
Place the control on form as shown in figure.

Step3: Identifying Resources that needs to be localized (Globalization Phase).
We want the output as shown in figure:

So here Resource that needs localization are

Language Name Label
Long Date Label
currency Label
Amount Label
Welcome Label (It would be same for all language, except its formatting might change, Note: you can do this easily with style-sheet concept, but as an example here I am explaining it with globalization concept.)

Now, Applying Localization to resources which needs to be localized and globalization phase. (Localization Phase begin).

Step5: Creating Resource File.
For this example i am creating resource file for French and German culture and other culture would get value from default resource file. Right click the Project in Solution Explorer and add a “asp.net folder”

Add App_GlobalResources Folder Add App_LocalResources Folder

Adding Global Resource File under App_GlobalResources Folder

Adding Local Resource File under App_LocalResources Folder

Note: While creating resource file, you should name resource file with filename.aspx.cultercode.resx

1 For Default.aspx file, Default resource file would be Default.aspx.resx

2 For German resource file for Default.aspx would be Default.aspx.de-DE.resx

3 For French resource file for Default.aspx would be Default.aspx.fr-FR.resx

Step6: Adding code in .CS file to make it work

Adding Namespace
using System.Globalization;
using System.Drawing;
using System.Threading;

Filling Dropdown with set of languages for user-choice.
Code in Page Load Event.

//Applying Globalization to Header Text
lblWelcome.Text = Resources.GlobalResource.HeaderTitleText; lblWelcome.ForeColor = Color.FromName(Resources.GlobalResource.HeaderTitleColor);
//CultureInfo Class GetCultures gives collection of language.
foreach(CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
//Filling the language collection into drop-downlistbox for user choice.
ddlLanguage.Items.Add(new ListItem(ci.EnglishName,ci.Name));
//Calling the Event when page loads for the first time.

Assigning selected language value to current thread, to reflect changes.
private void ddlLanguage_SelectedIndexChanged(object sender, System.EventArgs e)
Thread.CurrentThread.CurrentUICulture = new CultureInfo(ddlLanguage.SelectedValue);
Thread.CurrentThread.CurrentCulture = new CultureInfo(ddlLanguage.SelectedValue);

//Applying Localization

Code which requires localization value.
private void ApplyUILocalization()
lblLanguageName.Text = Convert.ToString( this.GetLocalResourceObject("LanguageName"));
lblLongDate.Text = Convert.ToString( this.GetLocalResourceObject("LongDate"));
lblCurrency.Text = Convert.ToString( this.GetLocalResourceObject("Currency"));
lblAmount.Text = Convert.ToString( this.GetLocalResourceObject("Amount"));

Code which does not requires localization.
private void ApplyLocalization()
//Lets Assume currency and amount to keep example simple.
double dblCurrency = 500.50;
double dblAmount = 9580000.75;

//No extra effort for localization as you see here.
txtLanguageName.Text = ddlLanguage.SelectedItem.Text;
txtLongDate.Text = DateTime.Now.ToLongDateString();
txtCurrency.Text = dblCurrency.ToString("c");
txtAmount.Text = dblAmount.ToString("n");

Now, run the application and select the different culture and based on selection you will get the localized display as shown in figure:

When associated resource file not available culture from Default Resource File would be shown.

how simplest syntax structure is used to perform globalization and localization.

Saturday, February 17, 2007

Writing a Quality Code with Microsoft Visual Studio Team System

For Writing a Quality Code with Microsoft Visual Studio Team System

A good set of guidelines to improve coding mistakes and improve quality of code.


Thursday, February 15, 2007

Distance Learning MBA

Distance Learning for MBA from Top B-Schools in India....


Monday, February 12, 2007

Please Wait Screen for heavy loading task

To display Please Wait Screen

Add Following line in .aspx file

In head Tag

<head runat="server">
    <title>Please Wait Screen</title>
    <script language = "javascript">
    function showPleaseWait()
        document.getElementById('PleaseWait').style.display = 'block';

In Body Tag

    <form id="form1" runat="server">
        <div class="helptext" id="PleaseWait" style="display: none; text-align:right; color:White; vertical-align:top;">
            <table id="MyTable" bgcolor="red">
                        <b><font color="white">Please Wait...</font></b>
            <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click"  onmouseup="showPleaseWait()"/>    
Note: here "Please Wait Screen" display logic is on mouse up event, so whenever heavy task started on button click event, "Please Wait..." Message will be displayed.
I have read this interesting code on gridviewguy.com.

Sunday, February 11, 2007

VS.net Customization

some of the customization in registry, so that VS.net looks and feel as per your choice...

Caustion: Editing registry can be dangerous.

Remove Projects from "Recent Projects" List of VS.net 2005
- Open a Registry (Type : regedit in run dialog box)
- Select HKEY_CURRENT_USER, Expand Tree
- Select Software, Expand Tree
- Select Microsoft, Expand Tree
- Select VisualStudio, Expand Tree
- Select Version of VS.net you want to customize. eg: 7.1 for VS.net 2003, 8.0 for VS.net 2005.
- Lets go for VS.net 2005, so select 8.0 and exapand tree
- Select ProjectMRUList and delete the File1, File2 and so on as per your desire and you find that Project is removed from "Recent Projects" List.

Remove Projects from "File Menu", "Recent Project List"...
- Open a Registry (Type : regedit in run dialog box)
- Select HKEY_CURRENT_USER, Expand Tree
- Select Software, Expand Tree
- Select Microsoft, Expand Tree
- Select VisualStudio, Expand Tree
- Select Version of VS.net you want to customize. eg: 7.1 for VS.net 2003, 8.0 for VS.net 2005.
- Lets go for VS.net 2005, so select 8.0 and exapand tree
- Select FileMRUList and delete the File1, File2 and so on as per your desire and you find that Project is removed from "File Menu, Recent Projects" List.

Similarly you can do custom settings for all the key available, like find, editor settings and so on...

Saturday, February 10, 2007

Default Focus in VS.net 2005

If you are using vs.net 2005 than the easiest way to focus the element is by using defaultbutton and defaultfocus property....

<form id="form1" runat="server" defaultbutton="btnSubmit" defaultfocus="txtName">
And if you are using master file than just add this statement in page_load event.

this.Form.DefaultButton = this.btnSubmit.UniqueID;
this.Form.DefaultFocus = this.txtName;

Thursday, February 08, 2007

JavaScript Verifier (Verify your Javascript)

Website for Verifying your javascript


It reports lots of small mistake which could be avoided and make javascript perfect... This will make application in multiple browser compatible.

Monday, February 05, 2007

Changing the default browser used in VS 2005 and Visual Web Developer

From ScottGu's Blog

I've seen a few people ask if it is possible to change what browser is launched and used when running web apps in VS 2005 and Visual Web Developer (for example: to use FireFox instead of IE). The good news is that there is an easy way to configure this. To-do this:

1) Right click on a .aspx page in your solution explorer

2) Select the "browse with" context menu option

3) In the dialog you can select or add a browser. If you want Firefox in the list, click "add" and point to the firefox.exe filename

4) Click the "Set as Default" button to make this the default browser when you run any page on the site.

Note that there is also an optional drop-down at the bottom of the dialog that lets you select the default browser window size when loading. You can choose 800x600 or 1024x768 if you want to visualize what the site will look like for people using those screen resolutions. This works for both IE and FireFox (and probably other browsers too -- those just happened to be the two I checked).

Saturday, February 03, 2007

Debugging of Javascript in VS.net

Debugging Javascript

Debugging of Javascript in VS.net

1) Open Internet Explorer, Tools menu -> Internet Option Dialog box.
- Click on Advance Tab.
- Clear the checkbox: Disable Script Debugging(Internet Explorer)
- Clear the checkbox: Disable Script Debugging(Other)

2) Use the keyword "debugger" in your script as breakpoint from where you want to start debugging.

Friday, February 02, 2007

Removing Duplicate Records from Dataset/DataTable

Removing Duplicate Records from Dataset/DataTable

Lots of time I found query for removing duplicate record from dataset, so here is the solution provided by Mr. Tony of DotNetSpider. Little bit workout done by me...

Including Duplicate Rows, Datatable looks like

public DataTable RemoveDuplicateRows(DataTable dTable, string colName)
Hashtable hTable = new Hashtable();
ArrayList duplicateList = new ArrayList();

foreach (DataRow drow in dTable.Rows)
if (hTable.Contains(drow[colName]))
hTable.Add(drow[colName], string.Empty);

foreach (DataRow dRow in duplicateList)

return dTable;

protected void Button1_Click(object sender, EventArgs e)
string strConn = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
SqlConnection conn = new SqlConnection(strConn);
SqlDataAdapter da = new SqlDataAdapter("select * from emp", conn);
DataSet ds = new DataSet();
da.Fill(ds, "Emp");
DataTable dt = ds.Tables["Emp"];
dt = RemoveDuplicateRows(dt, "empname");
GridView1.DataSource = ds.Tables["Emp"].DefaultView;

Excluding the duplicate rows from dataset/datatable

Most Recent Post

Community Updates

Subscribe Blog via Email

Enter your email address:

Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape