Over a million developers have joined DZone.

Getting Access To Cell Contents Within Your GridView

·
Add OnRowDataBound = "RowDataBound" to your GridView control on your ASP.NET page
Add the below code to your code-behind page


public void RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.DataItemIndex > -1)
    {
        e.Row.Cells[0].Text = string.Format("{0,C}", e.Row.Cells[0].Text);
    }
}
Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}