asp.net - Need to display total price in gridview -


Just trying to display my total price from a column in my footer line here is my code that trying But also it does not seem to be going through it when I put a brake point in

  subgvPayments_RowDataBound (byVal Sender, ByVal E as GridViewRowEventArgs) as the object Row.Roup = Data ControllerView.Data then the total portion of the unit part and volume total Add to the invoice Total + = Convert. ToDecimal (DataBinder.Eval (e.row.DataItem, "Total")) ElseIf e.Row.RowType = DataControlRowType footer then E. Ro Seals (0). Text = "total:" 'For footer, display the running values ​​e.Row.Cells (5). Text = invoicelet Toaster ("c") e. Ro.kel (5) .HorizontalAlign = HorizontalAlign.Right E. Ro.fonts.bold = True and End and SE   

If you need any of your more codes, just ask!

I like to use a method which does not need to handle any event is. It uses only a TemplateField and some different functions. In your GridView, create columns like this:

  & lt; Asp: TemplateField HeaderText = "Total" & gt; & Lt; Item Theme & gt; & Lt;% # DisplayAndAddToTotal (Eval ("Total"). ToString (), "Total")% & gt; & Lt; / ItemTemplate & gt; & Lt; FooterTemplate & gt; & Lt;% # GetTotal ("Total")%> & Lt; / FooterTemplate & gt; & Lt; / ASP: TemplateField & gt;   

The second parameter for DisplayAndAddToTotal can be whatever, as long as you use the same string in GetTotal, a string can occur. I usually re-use the field name again though. Here are two functions used, display and editable and gatecoat. They use a hashtable to store yoga, so that it works with any number of columns, which you want to add. And they also work with calculating the number of "true" for the boolean field. Hashtable = New HashTable () as Protected Total Protected function displays ANDAddToTotal (Type as string, type as string) Double item as double item item if itemStr = "True" then item = 1 ElseIf is not double. TRI mercury (item STR, item) then total = if item = 0 is finished. (Type) of the canteen then the total (type) = double. Try to double try as double the mercury (total type) .trustring ()) + item left total (type) = item end if the item end function protected function GetTotal (as typing string) double = double. Purse (as a total (type). Toaster ()) Return results Catch returns 0 End end and end function

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -