calculated column in datagrid question

Discussion in 'ASP .Net' started by =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=, Mar 23, 2005.

  1. can you populate a colmun in a data grid with a calculated value and can this
    be done on databind?

    I have a datagrid that is populated with a shopping cart. This data comes
    from the database. I have a quantity and price that i'd like to calculate in
    a function and show as a line total. What's the best way to do this.
    thanks
    kes
    =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=, Mar 23, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=

    Curt_C [MVP] Guest

    Use a template column and yes, you can do pretty much what you want with it.

    --
    Curt Christianson
    Site & Scripts: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "Kurt Schroeder" <> wrote in message
    news:...
    > can you populate a colmun in a data grid with a calculated value and can
    > this
    > be done on databind?
    >
    > I have a datagrid that is populated with a shopping cart. This data comes
    > from the database. I have a quantity and price that i'd like to calculate
    > in
    > a function and show as a line total. What's the best way to do this.
    > thanks
    > kes
    Curt_C [MVP], Mar 23, 2005
    #2
    1. Advertising

  3. If i bind the data directly to the datagrid like this: dgCart.DataSource =
    cmdCart.ExecuteReader() how do i reference the data in the itemDataBound sub
    if it is not included on in the datagrid as a column? (as a
    <asp:boundcolumn...)

    "Curt_C [MVP]" wrote:

    > Use a template column and yes, you can do pretty much what you want with it.
    >
    > --
    > Curt Christianson
    > Site & Scripts: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "Kurt Schroeder" <> wrote in message
    > news:...
    > > can you populate a colmun in a data grid with a calculated value and can
    > > this
    > > be done on databind?
    > >
    > > I have a datagrid that is populated with a shopping cart. This data comes
    > > from the database. I have a quantity and price that i'd like to calculate
    > > in
    > > a function and show as a line total. What's the best way to do this.
    > > thanks
    > > kes

    >
    >
    >
    =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=, Mar 23, 2005
    #3
  4. I'd like to avoid including hidden columns if i can

    "Curt_C [MVP]" wrote:

    > Use a template column and yes, you can do pretty much what you want with it.
    >
    > --
    > Curt Christianson
    > Site & Scripts: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "Kurt Schroeder" <> wrote in message
    > news:...
    > > can you populate a colmun in a data grid with a calculated value and can
    > > this
    > > be done on databind?
    > >
    > > I have a datagrid that is populated with a shopping cart. This data comes
    > > from the database. I have a quantity and price that i'd like to calculate
    > > in
    > > a function and show as a line total. What's the best way to do this.
    > > thanks
    > > kes

    >
    >
    >
    =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=, Mar 23, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. samir
    Replies:
    0
    Views:
    558
    samir
    Dec 21, 2005
  2. Craig L. Taylor

    Offset not calculated properly

    Craig L. Taylor, Mar 4, 2005, in forum: Java
    Replies:
    0
    Views:
    326
    Craig L. Taylor
    Mar 4, 2005
  3. sck10

    GridView: Calculated Field

    sck10, May 19, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    3,447
    Walter Wang [MSFT]
    May 19, 2006
  4. Replies:
    2
    Views:
    15,816
  5. Raghu Raman

    Probs in: Data grid calculated column Itemtemplate

    Raghu Raman, May 12, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    264
    Ken Cox [Microsoft MVP]
    May 14, 2005
Loading...

Share This Page