SIGN UP MEMBER LOGIN:    
ARTICLE

Using Expression Property to create Columns with Dynamic Values

Posted by Jaish Mathews Articles | Active Directory C# October 09, 2006
This article shows how to create columns with dynamic values using expression property.
Reader Level:
Download Files:
 

I noticed in many database designs with columns which will keep some dynamic values. The fact is that those dynamic values may alter at any time and then the user wants to change them in the database also. My opinion is that dynamic values should handle with dynamic columns whenever possible. We can easily do it from front end in C# using the expression property of the data column. Just download the code along with this, as then there may not be a need for further explanation.

Data column has a property named expression. Normally we can assign a value to this property as a relation with other columns and display a value which may depend on values from other columns. Here I created 3 dynamic columns named, PF, Bonus and Total Amount. First 2 columns PF and Bonus have expressions like their value will generate from a column named basic salary. I.e. user will enter the PF and Bonus rates from front end and corresponding PF and Bonus columns will automatically generate using the expression property on them. The last column Total Amount will generate using an expression like (basic salary - PF + Bonus), otherwise that is the expression assigned to that last column and that column will generate a value dynamically which will satisfy this equation. Finally all items will bind to a grid view. Cool isn't it? I used Visual Studio 2005 with web project template for the example along with this article.

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor