473,657 Members | 2,996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Performing calcualtions on data in gridview

Is it possible to perform calculations on data in your gridview in your
ASP, or do you need to do any calculations in the OnRowDataBound event?
Here is what I am trying to do :

<asp:TemplateFi eld HeaderText="Tar get (%)"
SortExpression= "TargetPercenta ge">
<ItemTemplate >
<asp:Label ID="lblTargetPe rcentage"
Text='<%# Eval("TargetPer centage")*100 %>' runat="server"> </asp:Label>
</ItemTemplate>
<ItemStyle Height="24px" Width="50px" />

*** Sent via Developersdex http://www.developersdex.com ***
Jun 20 '06 #1
2 1504
I would make the calculation part of the sql statement or part of the stored procedure so that the gridview simply displays the
calculated results
"Mike P" <mi*******@gmai l.com> wrote in message news:Or******** *****@TK2MSFTNG P03.phx.gbl...
Is it possible to perform calculations on data in your gridview in your
ASP, or do you need to do any calculations in the OnRowDataBound event?
Here is what I am trying to do :

<asp:TemplateFi eld HeaderText="Tar get (%)"
SortExpression= "TargetPercenta ge">
<ItemTemplate >
<asp:Label ID="lblTargetPe rcentage"
Text='<%# Eval("TargetPer centage")*100 %>' runat="server"> </asp:Label>
</ItemTemplate>
<ItemStyle Height="24px" Width="50px" />

*** Sent via Developersdex http://www.developersdex.com ***

Jun 20 '06 #2
If the calculations required input that was not available within the
database, you could retrieve the dataset with a constant value column
and then perform the calculation on the dataset before binding to the
datagrid.
Jon Paal wrote:
I would make the calculation part of the sql statement or part of the stored procedure so that the gridview simply displays the
calculated results
"Mike P" <mi*******@gmai l.com> wrote in message news:Or******** *****@TK2MSFTNG P03.phx.gbl...
Is it possible to perform calculations on data in your gridview in your
ASP, or do you need to do any calculations in the OnRowDataBound event?
Here is what I am trying to do :

<asp:TemplateFi eld HeaderText="Tar get (%)"
SortExpression= "TargetPercenta ge">
<ItemTemplate >
<asp:Label ID="lblTargetPe rcentage"
Text='<%# Eval("TargetPer centage")*100 %>' runat="server"> </asp:Label>
</ItemTemplate>
<ItemStyle Height="24px" Width="50px" />

*** Sent via Developersdex http://www.developersdex.com ***


Jun 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5673
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the GridView to allow entry of quantity and Y/N switch for
4
2611
by: Nalaka | last post by:
Hi, I have two questions about gridViews. 1. How can I intercept the row/column values at loading to change values? 2. After I update a row (using default update functionality), how can I re-format the updated row fields. I have looked at gridView.rowUpdated method, but cannot figure out how....
7
14802
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I want to look at that data and filter it based on what is in it. I know that this could have been done with data sets and data views in asp.net 1.1 but how is this done now in asp.net 2.0?
1
2304
by: Siva | last post by:
Hi, I have a 3 tier ASP.Net app for a handheld which needs to fetch orders from database via a DAL and populate it in a gridview using objectdatasource. In the search page I have a few parameters and when the search button is clicked I am sending those parameters via query string ( I need to do this since my app will run in a handheld which has certain restrictions). In the order list page, I am passing those parameters to the DAL as...
5
6436
by: sutphinwb | last post by:
Hi - This could be a simple question. When I relate two tables in a datasetet, how do I get that relation to show up in a GridView? The only way I've done it, is to create a separate table in the dataset with a join query for the GetData() select method. I use ObjectDataStore to couple the GridView with the table adapter on the dataset. If I point the ODS at the child table, the GridView will bind to the "normal" select and I end up...
2
2271
by: Nick Hodge \(MVP\) | last post by:
Hi I currently have a gridview connected to a SQLDatasource. (This data comes from a remote iSeries). It shows catalogue sales as they build during the day (works great). I have a local SQL server with the budget data for each catalogue/day and wanted to compare the gridview data with this to display KPI traffic lights as the sales build. (This is used across the organisation and is connected 'live') One issue is that all catalogue...
8
18078
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to display data in a "GridView" which is tied to an "ObjectDataSource". In turn, this ObjectDatasource gets it's data from a strongly-typed business object within my code.
6
3701
by: rcoco | last post by:
Hi, I have a datagrid that is ment to insert data. But when I run the form only the header appears. I would like some advise from you all and solve this problem I'm using visual studio 2003. My code looks like this: private void Fill() { DataTable table = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter("SELECT * from
0
1292
by: jaz215 | last post by:
Hi i have an update page where i update data when a user select a row in the gridview, i also have a search function that displays the data in the gridview all those data that matched the search. my problem is that when i select the data after i search it the selected input would be coming from the previous gridiview look of the data example: standard gridview look Gridview 1strow 2ndrow 3rdrow
0
8302
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8820
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8499
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8601
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.