Save calculated value in gridview

  • Thread starter Thread starter staeri
  • Start date Start date
S

staeri

I have a gridview which calculates a value in a templatecolumn. I want
to save the calculated value into the database when all the other data
is saved. How can I do that?

As it is now I don't have any code-behind, I'm only using the built-in
ASP.NET 2.0 functions.

The templatecolumn looks like this:

<asp:TemplateField HeaderText="Belopp (kr)"
FooterStyle-Font-Bold="True" HeaderStyle-HorizontalAlign="right"
ItemStyle-HorizontalAlign="right" FooterStyle-HorizontalAlign="Right">

<ItemTemplate>
<%#GetAmount(Decimal.Parse(Eval("UnitPrice").ToString())).ToString("N2")%>

</ItemTemplate>

</asp:TemplateField>

// SE
 
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound

If e.Item.ItemType = ListItemType.Footer Then

dim sumTotal as double = Ctype(e.Item.Cells(1).Text ,double)

'OK, Now do something with the value

End If



End Sub
 
Back
Top