January 2005 - Posts

Tracing Enhancements in ASP.NET 2.0

I have published an article on “Tracing Enhancement in ASP.NET 2.0“ in my site. Here is the short description about this article,

Tracing is the new feature introduced in ASP.NET 1.x. This feature is used to track application execution flow, which can be used for diagnosing problems in production environment. Tracing also provides other details like Session Details, View State details and debugging messages emitted from the code, which also help to diagnose problems. ASP.NET 2.0 comes with few improvements in this feature. This article discusses some of the tracing enhancements of ASP.NET 2.0. Following are the list of improvements covered in this article, 

  1. MostRecent Attribute in Trace configuration
  2. Programmatic access to Trace messages
  3. Integration between system.diagnostics.trace and httpcontext.trace  

For more information....

with 0 Comments

Five Undiscovered Features on ASP.NET 2.0

You may have read some of the many books and magazine articles previewing the upcoming features. You might even have seen a live demo at a conference or user group meeting. But how well do you really know ASP.NET 2.0? Did you know, for example, that those wonderful $ expressions used to declaratively load connection strings and other resources can be extended to create $ expressions of your own? Did you realize that the new ASP.NET 2.0 client callback manager provides an elegant solution to the problem of keeping browser displays in sync with constantly changing data on the server? Did you know that you can encrypt sections of Web.config to prevent connection strings and other potentially injurious data from being stored in plaintext?

Jeff Priose talks about following five undiscovered features on ASP.NET 2.0 in his article,

  1. Client Callback
  2. Custom expression builder
  3. Encrypted Configuration Sections
  4. Auto culture handling.
  5. Custom Web events..

I am exploring custom web events for monitoring asp.net applications now... Soon you can except a blog on this topic....

with 0 Comments

Power of Client Scripts - Software should understand user feelings...

Today I was accessing my corporate mail account in my home through dialup. I was replying to one of the mails from my Project Manager. After writing few paragraphs about my current work, I pressed send button. Then only I noticed my dialup connection was terminated, all my mail contents were lost. I told myself that I should have saved this mail somewhere. I reconnected to net and I was ready to type the mail again. But after I opened the mailbox compose screen, I got a popup..

 

   WARNING: The following email was interrupted and was never sent

                        From : saravana@abc.com

                        To: Mymanager@abc.com

                        Do you wish to restore it?

                        Yes or No

 

I thought for while “this software understands my feelings”… I pressed yes.. please restore it… It restored that mail completely.. I was amazed with this feature at that time.. It saved me lots of time …

 

Then I was curious to know how they have implemented this feature. I did viewsource and got the code. Using javascript “SetInterval” function they executed a client side function continuously after certain interval. In that function, they saved the content of the mail to cookie (if cookie is disabled, they stored the data in side frame). When compose mail page is opened, they will check whether any data is there in cookie. If data is there, they will show a confirmation message for restoring that data. Though it looks simple, they have written around 50 lines of code for implementing this feature.

 

I faced this problem few times with .Text also, but I couldn’t restore the blog content back. Nowadays I used to write my blog in notepad or in my mailbox before I post it. It would be great if .Text supports this feature also…

 

with 0 Comments

EnableSortingAndPagingCallbacks in ASP.NET GridView Control

Another useful feature in Gridview control is EnableSortingAndPagingCallbacks. If you set this property to true, then sorting and paging of Gridview will happen without page refresh. This feature will be very useful when you have a complex page with lots of controls including Gridview. Therefore, for sorting or paging a Gridview data you need not render the page again. Good thing here is it is done by framework. You just need to set this property to true. Framework will take care of doing callback and updating gridview back with new data. This feature uses callback feature of asp.net whidbey to do this. I have explained about callback feature in my previous blog

Let us see how this EnableSortingandPaging Callback works,

<asp:GridView ID="GridView1" Runat="server" DataSourceID="SqlDataSource1"

AutoGenerateColumns="False" AllowSorting="True"

EnableSortingAndPagingCallbacks=true  PageSize= 5 AllowPaging=true>

  <Columns>

      <asp:BoundField HeaderText="phone" DataField="phone" SortExpression="phone"/>

      <asp:BoundField HeaderText="city" DataField="city" SortExpression="city"/>

      <asp:BoundField HeaderText="state" DataField="state" SortExpression="state"/>

  </Columns>

</asp:GridView>

If you set EnableSortingAndPagingCallbacks property to true, asp.net framework will insert necessary client side code to do callback when your press paging elements or sorting elements. The client scripts which are required for this callbacks are stored in WebResource.axd?a=s&amp;r=GridView.js&amp;t=632349364554375000 .

Note: You can view this file in Temporary Internet folders.

Similarly if you view the serverside code for implementing this feature, they have overridden RaiseCallBackEvent method of ICallbackEventHandler in Gridview.

     
string ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
      // setting sorting key and paging index from event argument…
       HtmlTextWriter writer2 = new HtmlTextWriter(writer1);
      this.DataBind();
      this.RenderTableContents(writer2);
      writer2.Flush();
      writer2.Close();
      string text2 = formatter1.Serialize(this.SaveDataKeysState());
      object[] objArray1 = new object[11] { "\"", this.PageIndex, "|", (int) this.SortDirection, "|", this.SortExpression, "|", text2, "|", writer1.ToString(), "\"" } ;
      return string.Concat(objArray1);

}

In this, they are setting page index, sorting key and rebinding the GridView. After rebinding, they are extracting the HTML elements from GridView and then sending that to client. Client script will replace this Gridview data with these new HTML elements.

Note:  I didnt cover about how Gridview is maintaining page index and sorting key between postbacks and callbacks. In addition, there is one issue with this  is explained by Dino in this article.

I thought of implementing this feature for Auto refresh Datagrid in ASP.NET 1.1 in a similar manner.

I think Microsoft can think of implementing AutoRefresh GridView. They need to have Autorefresh property to Gridview. This property will help GridView to automatically refresh after certain interval. You can mention the interval time also. It can use the same framework of EnableSortingAndPagingCallbacks. I have seen many questions about Autorefresh Datagrid in newsgroups. If many people require this feature, I think they can include this feature.

If any of you require similar feature (Auto Refresh GridView), then post your comments here.

 

with 0 Comments

Microsoft is proving again and again that they are listening to customers...

Last  month I blogged about SyncWithAD_Lookup error during VSTS Installation. John Lawrence (Development manager in Microsoft VSTS Team) posted a comment for that blog today. Microsoft accepted this as a bug in this release and it will be fixed in next release. This information has been posted in VSTS Team blog. What I am impressed with this is, Microsoft's interest in customer feedback to improve their product. I just posted about this error in my blog, I didnt event post it in Microsoft Feedback Center. However, they noticed this blog and took it as a feedback. Not only this, I have posted two bugs(1 and 2) in Microsoft Feedback Center. For that also, I got replies within two to three weeks times.. All this proves that Microsoft is listening to customer constantly...

So guys, if you have any feedback or comments about Microsoft Products. Post it.. Microsoft will listen to you...

with 2 Comments

If you want to succeed in your career...

Selling your proposal to your boss is critical to your success. If you can’t get your boss’s approval when you need it, you are not going to go very far in your career. Michael Hyatt explains in his blog, how effectively you can sell your proposal to your boss.. Good one to read... It will surely help you to move forward in your career...

 

with 0 Comments

A Tip on ASP.NET 2.0 Gridview Control

GridView is coming with a new element called EmptyDataTemplate and a property EmptyDataText. As you guessed, this template or property will be showed when you bind an empty datasource( for example dataset without any rows) to GridView. Though it is a simple feature, it was not there in previous databound controls like repeater and datagrid. We used to manually find out whether datasource is empty or not, depending upon that we will show some panel or message. Now you can use this feature for that.

Empty DataText property can be used to show a message to the user in case of empty datasource.

EmptyDataTemplate can be used to mention template( i.e. any controls..) to show in case of empty datasource. The template can also be used to show simple message. For example

<asp:GridView ID="GridView1" Runat="server" DataSourceID="SqlDataSource1"

AutoGenerateColumns="False" EmptyDataText="No Product" >

        <EmptyDataTemplate >               

            There in no product in your cart.

        </EmptyDataTemplate>

            <Columns>

                <asp:BoundField HeaderText="au_lname" DataField="au_lname"  />

                <asp:BoundField HeaderText="au_fname" DataField="au_fname" />

                <asp:BoundField HeaderText="phone" DataField="phone" />

                <asp:BoundField HeaderText="address" DataField="address" />

            </Columns>     

</asp:GridView>

If you mention both EmtpyDataText and EmptyDataTemplate, then EmptyDataTemplate takes precedence.

with 0 Comments

Free E-book - Dissecting a C# Application: Inside SharpDevelop

Free e-book - Dissecting a C# Application: Inside SharpDevelop is available in Apress.com.

Here is the short introduction about this book,

Learn advanced .NET programming techniques by getting an insiders' look at a complete application! The developers who created SharpDevelop give you an inside track on application development with a guided tour of the source code for SharpDevelop. They will show you the most important code features and explain how you can use these techniques in your own projects. You will gain valuable experience of building an application on this scale, learning from the decisions, mistakes, problems and solutions that lead to the current version on SharpDevelop.

 

with 0 Comments

Deliverables from Microsoft in 2005

Wish you all a very happy new year... May all your dreams come true this year...

This is my first post in this new year, so I thought of blogging about the product releases that you could expect from Microsoft in 2005.

Bink has provided list of products that will be released this year based on his assumptions. Here is the list, which I am interested in,

Biztalk 2004 64
Commerce Server 2002 64
Windows XP x64
Windows Server 2003 x64
SQL 2000 Service Pack 4
Virtual Server 2005 Service Pack 1
Windows Server 2003 Service Pack 1
Longhorn Beta (client)
Longhorn Server Beta 1
MSN Messenger 7
MSN Search web
MSN Search desktop
Office 12 Beta
Sharepoint Portal Server 2005
ADAM 2.0
Visual Studio 2005
Visual Studio 2005 express editions (C#, VB, ...)
Visual Studio 2005 Team System
SQL Server 2005
SQL Server 2005 Express Edition
AntiVirus ?
AntiSpyware
.NET Framework 2.0
Commerce Server 2006 beta
ASP.net 2.0

For complete list, check out this article

with 0 Comments