We help IT Professionals succeed at work.

Formatting a gridview bound to a data table

jrhundsr
jrhundsr asked
on
172 Views
Last Modified: 2010-04-23
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()
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.