Friday, March 20, 2009

HOW TO: Get the IP Address of a visitor

Just simple:


IE 8 Released

Hello ASP.NET developers, IE8 is released now. If you are an IE user, I know how eagerly you all awaited for final release of IE. You can download it from the IE homepage.


ASP.NET MVC 1.0 Released

Do you heard? ASP.NET MVC 1.0 is out now. You can download it from Microsoft download center.


Manning’s ASP.NET AJAX

Manning's ASP.NET AJAX

I’m getting some free time, now a days. So I started reading the book ASP.NET AJAX from Manning. On my further post I’ll be posting some good tips/tricks/must-haves from this book.


Thursday, March 19, 2009

Control.ClientID in ASP.NET 4.0

One of the repeated question in ASP.NET forums is “How to access the server-control from client-side?” I’ve wrote an article regarding it. You can find it here.

With the release of ASP.NET 4.0, MSFT development team is introducing an alternate approach for accessing the server-side controlID from client-side. With the release of 4.0, a new property called ClientIDMode has been introduced to control the behavior of the ID displayed in client-side.

The ClientIDMode property has 4  modes and are as follows:

a) Legacy 
In this mode, the ControlID behaves as in framework 2.0, 3.0 and 3.5). That means a textbox in a Master-Page may looks like ctl00_MasterPageBody_ctl01_Textbox1.

b) Inherit 
This is the default value for every control. This mode looks at the controls parent to get its value for ClientID.

c) Static
As the name suggests, it makes the ClientID static. But keep in mind, if you declare 2 controls-id as same; you’ll be popped-out.

d) Predictable.
This models commonly used along with databound controls. The framework traverse the control hierarchy pre-fixing the supplied ID along with its Parent’s ControlID until it reaches a control in the hierarchy whose ClientIDMode is static. For a control placed in a databound control, a suffix with a value that identifies that instance will be added to the supplied ID . The clientIDRow suffix property is used to control the value that will be used as a suffix, e.g: Gridview1_Label1_0.

I know you’ll be eager to see some examples. A more detailed explanations along with the examples can be found at ASP.NET  Weblogs.

Thursday, March 12, 2009

Mr Bean



Last day, a friend of mine send me an attachment of Mr.Bean. Just see how beautiful & lovely it is. I always loved his TV series.

Response.Redirect vs Server.Transfer

The Response.Redirect method sends a message to the requesting client to request a new page. This requires a round trip between the browser and the server, but allows the user to see the new URL in the browser address bar.

Server.Transfer is a quicker approach which simply loads the specified page without the round trip. As a result, the browser’s address bar is not updated.

ASP.NET Postback flow

There is a nice pictorial demonstration of the ASP.NET Postback cycle flow in Randy Connolly’s website.

Have a look.


Server-side comment & Client-side comment

While programming, I use the comment/un-comment menu in the Visual Studio toolbar. The commented portion looks like, for example

<%-- Some Comment/Code here --%>

Later on only, I paid attention to it; as what makes it different from our normal HTML comments like;

<!-- Some Comment/Code here -->

The difference is simple. The former is called server-side comment & the latter is client-side comment. Serer-Side comments are not returned to the browser, while the client-side comments are returned to the browser.

Realizing, how I strained/managed to learn complex codes, without paying attention to such a silly thing. We all need Big without realizing what is Small.

Wednesday, March 11, 2009

EnableDecompression in ASP.NET WebService

Suppose that the Web Server from which a Web-Service client is requesting Web-Service supports compression; then the web-service client will receive respone as compressed data.

We can disable the decompression by setting the EnableDecompression property to true.

// on client web-application
Service srvc1 = new Service();
srvc1.EnableDecompression = true;
// call your web-service method here (example)
string dtime = srvc1.ReturnDateTime();

Tuesday, March 10, 2009

IE Bookmark Sync

As I’s busy with my programming world, I came across a lot of articles, bookmarked a lot of pages. Formatting my PC was a real headache for me, as I’ll be losing my bookmarks. Since, I’s using IE (currently using IE8 RC1) as my default browser, I cannot think about using FF for syncing the favorites using FoxMark.

As the FoxMark download crossed 13 million, they planned to extend the service to IE & Safari. Though, the FoxMark was for IE 6 & 7; I tried it for IE8 RC1. Charmingly, it worked.

I must say, it’s a must have for fellows who bookmarks a lot.

Download it here.

I’m on 1000+


Just now only I noticed that i scored a 1000+ points in the Microsoft official ASP.NET forum. Happy to see that I’ve helped some developers. Also happy, I got some new techies too.


Edit/Update/Delete GridView automatically

There is an easy way to edit/delete/update rows in a GridView data control.

All you have to do is:

a) Configure SQLDataSource data-control.

b) Select a table.

c) Select column-field(s) including the primary-key column.

d) To the right, click on the Advanced button & select ‘Generate INSERT, UPDATE and DELETE statements’.


c) Click Next; test-query & click Finish.

Now, go back to your GridView. On the smart-tag, select ‘Enable Editing’ and ‘Enable Deleting’.


That's it. Now run the page, try to editing/updating/deleting the records. Leave everything to SQLDataSource. You are hands free now.

How easy, isn't it ?

Monday, March 9, 2009

C# Code Formatter (Online)

There is an online C# code formatter, at Manoli. The output confirms to be HTML 4.01 specification & is color-coded. Also easier to read. It also supports VB, T-SQL, HTML, etc. So, have a look @ Manoli.

Sunday, March 1, 2009

Vista Ultimate Tips and Tricks PDF

Though I own a Vista Ultimate PC; I’s searching the internet looking for articles/post for exploring the features of Ultimate edition to the maximum. Now, M$FT themselves has released a PDF, for exploring the same.


Explore here.

Best viewed in Internet Explorer 8.