Link to home
Start Free TrialLog in
Avatar of jrhundsr
jrhundsrFlag for United States of America

asked on

Formatting a gridview bound to a data table

Ok I am binding a gridview and a datatable and I dont know how to set the dataformatstring of the gridview to $.  

Like This:
        Dim table As New DataTable
        table.Columns.Add("Category")
        table.Columns.Add("Year Total")
        table.Columns.Add("Year Left")
        table.Columns.Add("Month Total")
        table.Columns.Add("Month Left")
       
        Dim row As DataRow = table.NewRow()
        row("Category") = "Food / Groceries"
        row("Year Total") = a1.ToString
        row("Year Left") = a1yleft.ToString
        row("Month Total") = a1m.ToString
        row("Month Left") = a1mleft.ToString
        table.Rows.Add(row)
        Dim row2 As DataRow = table.NewRow()
        row2("Category") = "Household / Maintenance"
        row2("Year Total") = a2.ToString
        row2("Year Left") = a2yleft.ToString
        row2("Month Total") = a2m.ToString
        row2("Month Left") = a2mleft.ToString
        table.Rows.Add(row2)
        Dim row3 As DataRow = table.NewRow()
        row3("Category") = "Program / Other"
        row3("Year Total") = a3.ToString
        row3("Year Left") = a3yleft.ToString
        row3("Month Total") = a3m.ToString
        row3("Month Left") = a3mleft.ToString
        table.Rows.Add(row3)
        GridView5.DataSource = table
        GridView5.DataBind()
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial