VS 2008 - How To Calculate Between Two Columns In Gridview Control

Jan 6, 2012

I have a simple gridview control on .aspx page. It has one combo box in the gridview control and rest of the columns in the gridview control are all bound controls.

When the user picks something from combo box, I should multiply the number (picked from the combo box) with other number in the same row (meaning in a different column on the same row). I want to do all this in server controls not thru JQuery or Javascript.

Basically my problem is I am able to read data from unbound combo box control in the grid. But I should be able to read the contents of another bound column in the same row and perform multiplication between those two fields.

<asp:GridView ID="GridViewActuals" runat="server"
DataSourceID="SqlDataSource1" DataKeyNames="gl_number"
onrowcommand="GridViewActuals_RowCommand" Height="285px"
Font-Names="Verdana" onrowupdating="GridViewActuals_RowUpdating1">

[Code] ....

View 2 Replies

Similar Messages:

Data Controls :: Calculate SUM Of Columns In GridView And Display In Label?

Dec 13, 2013

I have to display sum of Basic_Amt, Tax_Amt, Net_Payable in gridview without using database.

my query.

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="dataTables_wrapper"
CellPadding="4" ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />


View 1 Replies

Forms Data Controls :: GridView,calculate Value Based On Other Columns& Save To Datasource?

Nov 8, 2010

I had just started with Visual Studio 2008 + VB.net. I've now designed my tables, and basic gridview functions properly.Now I'm faced with the problem of having to calculate a value based on 2 - 3 columns/data in the gridview, display the result in an existing column in the same gridview, and saving the calculated value in the datasource.I had initially created the "Total" column as a textbox displaying a manually calculated amount that is saved in the datasource. Now, I want to change the field to auto-calculate based on 2 other columns.

View 4 Replies

VS 2008 Calculate Gridview Total OnBlur Event Of Textbox Using JQuery?

Jul 25, 2011

I need to attach a function to the onBlur event of a textbox column in my gridview. I know how to attach the event but I need calculating the total.

I have a TemplateField with a textbox as the ItemTemplate and Three labels in the FooterTemplate for Sub Total, VAT and Total.

So when I enter new values into the textboxes I want the totals to get calculated automatically as the textbox loses focus.

View 2 Replies

VS 2008 - Seeing Order Of Gridview Columns?

May 3, 2010

I've got a tough one (at least for me!). I have a gridview control which is actually from ComponentOne but most is the same as the normal gridview. It has a feature that lets me move columns around so they are in different order. I want to be able to click a button and see the order of these columns and which ones are visible. This is to be used for a custom report I am generating.

Does anyone know how to find out what columns are visible and in what order? I'm doing it in VB coding for asp.net.

View 3 Replies

VS 2008 Adding Columns To A Gridview Dynamically

Jul 13, 2010

I have seen code for adding columns at runtime but here is another scenario for you. I am using a SQLDatasource control for my gridview. And the data returned can have different columns based on the filter meaning one time I may have a column A1, A2, A3 and another time I may have A2, A3, A4. Is there any way I can look at the columns when it is binded at the beginning and add the columns first?

I really need to use the SQLDatasource though because I am connecting to an AS400 and it is using a connection already made in the webconfig and do not know any other way. I do if it was MSSQL server but not this.

View 6 Replies

VS 2008 Hiding Columns In Gridview After Binding All Rows?

Jul 22, 2010

I am trying to set come columns to invisible after all of the rows are binded but I'm having trouble. I'm hiding columns that have empty data which I save in a session variable. This works fine. Then I tried changing the columns visible property using the ColumnByName routine in the DataBound but that must be the wrong event because I do not think the columns exist yet.

The columns are autogenerated btw.

Where can I set the columns properties after it has binded? Can i do this before the columns are autogenerated the the screen itself?

View 4 Replies

Web Forms :: How To Calculate Data From Gridview Control

Nov 25, 2010

well i want to calculate data from a gridview field, you can see below the structure of my main page:


My Table1 contain these lines:


View 3 Replies

VS 2008 Gridview - Hide Certain Columns And Change Column Names

Jun 15, 2012

I have a gridview that I am loading from a stored procedure. I need to be able to hide certain columns and change the column names. Since it is loading with stored procedure the columns aren't listed in the gridview->edit columns properties.

View 1 Replies

Creating A Function To Calculate Two Database Columns / Values?

May 11, 2010

I am using ASP.NET 2008 Visual Basic Language. I tried to create a function that multiply two values from two different tables and get the result presented in a label. The value is retrieved by referring to the primary key after the user selects from a DropDownList which is in another page using sessions.

I tried to build this code in the Load_Page event but it didn't display for me the total.


View 4 Replies

Calculate Only System Date (visual Studio 2008)

Apr 3, 2010

I want to get only the current date and not time in asp.net( visual studio 2008). But in 2008 we have the properties associated with time like System.DateTime. How to calulate only system date?

View 4 Replies

Two Button Columns On A GridView Control?

Jun 16, 2010

I have a grid view will two different button columns. I want to perform a different action depending on what button the user presses. How in the SelectedIndexChanged event do I determine what colmun was pressed. This is the code I use to generate the columns.

ButtonField bfSelect = new ButtonField();
bfSelect.HeaderText = "View";
bfSelect.ButtonType = ButtonType.Link;
bfSelect.CommandName = "Select";
bfSelect.Text = "View";
ButtonField bfLink = new ButtonField();
bfLink.HeaderText = "Link/Unlink";
bfLink.ButtonType = ButtonType.Link;
bfLink.CommandName = "Select";
bfLink.Text = "Link";

View 1 Replies

How To Use ColumnName In GridView Control To Hide Some Columns

Aug 11, 2010

I want to hide few columns of a gridview before they gets displayed. I want to do it by create a common function which can be used by multiple controls. I am using an extension and would like to know how it can be done.

Here is my code


I want to create an extension to hide or show columns provided in the list as an array. 1st function is used on page. While below two functions are needs to be used for multiple applications

View 1 Replies

VS 2008 / Show The Data Either In Chart Control Or Gridview Control?

Feb 11, 2013

I have a simple .aspx page.

I want to show the data either in Chart control or Gridview control. When the user selects an option to see the data either in chart control or grid view control, that specific control has to show up and other control has to become invisible.

So far, I am able to populate data successfully in the chart control. If the user chooses "Grid view" option, how can I show the data in grid view control in the same location. I don't want the gridview control to be shown in a pop up window or any other window.

View 2 Replies

Web Forms :: Trying To Reproduce GridView.Columns Property In Custom Control?

Mar 9, 2010

I'm working on an ASP.NET 3.5 project that requires me to create several custom navigation server-side controls that can be customized at design time by non-ASP.NET website developers through a simple text editor. All but one were relatively easy to create, but the last one is stumping me. I've looked online and can't find any examples anyplace that come close to what I'm trying to do.The last control needs to give the site developers the ability to manually define the number of nodes that are displayed within the control when it's rendered on a page, and I want to reproduce the design time/runtime functionality of the GridView's "Columns" property. In the Columns collection the site developer at design time can manually specify the look/feel of each column within the ASPX designer. I want to give my site developers the same design-time flexibility so they can add/remove nodes at their whim and not bug me to do it for them.
an anyone point me to any examples of how to create a collection custom child controls that are associated with a custom server side control?

View 1 Replies

AJAX :: How To Display 4 Columns And It's Columns Name In AutoCompleteExtender Control

Feb 9, 2010

I am developing an web application. One of this form has a textbox. When the user enter chars i need to fetch the records from db and display as 4 columns in AUTOCOMPLETEEXTENDER CONTROL TOOL KIT and it's column name also. When the user click any one of the row, i need to get the 2nd clicked column name and display it in textbox.

how to display 4 columns and it column name in autocompleteextender control?

View 1 Replies

C# - GridView - Columns.Insert() Cause Data To Vanish On Postback But Columns.Add() Works OK?

Oct 13, 2010

I have a GridView that has several dynamic columns (I do not know how many at design time and it could be 0-12 columns, hence need for dynamic columns). I have the columns in the grid and data bound to them - works great. There are other standard, design-time TemplateField columns with TextBox controls in them. These are bound with values that the user can edit. The grid is posted back via a Submit button. My question is "Why does gv.Columns.Insert() cause all my TextBox data to be null on Postback, but gv.Columns.Add() works like a champ?"

protected void BuildColumns()
// The first column to begin to insert the columns in the GridView
int columnIndex = 5;
BoundField aoColumn = new BoundField();
aoColumn.HeaderText = "New Column 1";
gvMyGrid.Columns.Insert(columnIndex, aoColumn); // kills txtQuantity.Text on postback
gvMyGrid.Columns.Add(aoColumn); // works fine
foreach (MyEntity my in _myEntityCollection)
BoundField myColumn = new BoundField();
myColumn.HeaderText = String.Format("{0:d}", my.StartDate);
gvMyGrid.Columns.Insert(columnIndex, myColumn);

I then go on to assign values to these BoundFields in the _RowDataBound method and all of this works great. However, when I post back and try to reference some TextBox and they are all null. And yes, I have the BuildColumns() call wrapped in if (!IsPostBack) on Page_Load. Of course I would like to use .Insert() so that the columns can go in the proper location and not at the end of the Columns array.

View 1 Replies

Forms Data Controls :: In Page User Able To Select Gridview Columns And It Will Hide Remaining Columns

Mar 18, 2010

in asp.net page user able to select gridview Columns, and it will hide remaining columns and that selection done by check box with column list bellow is Image link , what exactly I am looking for [URL] it look bellow after selection of column done [URL]

View 1 Replies

Hide Columns In GridView With Auto - Generated Columns?

Jan 19, 2010

GridView1.Columns.Count is always zero even SqlDataSource1.DataBind();

But Grid is ok I can do

for (int i = 0; i < GridView1.HeaderRow.Cells.Count;i++)

I rename request headers here but

GridView1.Columns[i].Visible = false;

I can't use it because of GridView1.Columns.Count is 0. So how can I hide them ?

View 5 Replies

Show Several Columns In Datasource As Autogenerate Columns In Gridview?

Jan 27, 2011

I have a datasource, which includes many columns, idealy, I need use a gridview to show:

1) first 3 columns: template fields, these fields depends on values in some columns of datasource. I use template fields, hard coded. works fine.

2) the other columns. This is I do not know how to do it. In the data source, there are about 10-20 columns data, each time, the # of columns of the data varies. idealy, I need show each of them as a seperated column in gridview. The entire data source may have 30 columns, but some of them are used in 1), and I only want show these 10-20 columns in gridview. Some columns in data source, I may not use them at all. is there a way to do this? or have to seperate them as a detail view style UI?

View 1 Replies

Forms Data Controls :: Calculate To Current Rowafter Update Quantity But Other Rows Don't Affect And Not Calculate

Jan 6, 2010

my code is calculate to current rowafter update quantity but other rows don't affect and not calculate i need to calculate all rows i think i need to use for loops but i dont know how to do it



View 7 Replies

C# - Display GridView With Many Columns As Two Sets Of Columns?

Jan 20, 2010

I apologize for the odd title. I've been trying to figure out how to do this and can't quite put it into words. Basically, I need to try to display a GridView with a whole bunch of columns (37 in one case) in two "rows" of columns. More or less.

So instead of this:

Column1 Column2 Column3 Column4 Column5 Column6
Data Data Data Data Data Data
Data Data Data Data Data Data
Data Data Data Data Data Data

I'd like something like this:

Column1 Column2 Column3
Data Data Data
Data Data Data
Data Data Data

Column4 Column5 Column6
Data Data Data
Data Data Data
Data Data Data

As in the example there can be multiple rows returned which all need to be displayed. I'm trying to stop a very large horizontal scroll bar being required. I've been searching as much as I can but haven't found anything that fits what I'm looking for.

View 1 Replies

VS 2008 - How To Create A Custom Gridview Control

Dec 9, 2010

I'm creating a custom gridview control. so far I've been able to add custom sort arrows and an export to excel feature.

Now I want to have a textbox and a button in the header row to filter each row.

I want to extend either the boundfield or boundcolumn class to add a property that will allow me to distinguish wheter the column should have a filter textbox in the header.

View 37 Replies

VS 2008 - How To Build A Custome Gridview Control

Jan 17, 2011

I'm trying to build a custome gridview control. now I've gotten quite far and I am now a bit stuck. I have a property that allows me to specify the columns datatype.

Now when I specify either a datetime or date variable I need to format it properly. Thing is, if I use a database other than sql server how can I format the dates properly. ZI want to make my grid as reusable as possible.

If i use date.tryparseExact I need to know the foemat of the date value being passed in. Problem is, I won't always know the exact format.

View 11 Replies

VS 2008 - Add ModalPopup To Gridview Custom Control?

Jan 13, 2011

I have a Gridview Custom Control (class library project). What I want to do is, add a button to the page. Once the button is clicked, I need a ModalPopupEctender to come up with a checkboxlist of all the Columns in the SQLDataSource that populates the Gridview.

Now since this is a class library project that inherits from the Gridview, I'm not sure how I can add a div at the very top of the page, with the "Choose Columns" button.

Should I create a user control that contains my Custom Gridview? Reason I want to do what I ask is because I want to reuse this in as many projects as I can, I wan this functionality built in to my dll.

View 3 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved