DATA BINDING TO SPGRIDVIEW
Previous Post
So we're almost there. Previous posts, this is where we stand. We have set up our environment, we created the project, referenced the right dlls. We have retrieved the information we needed, We have filtered and retrieved a subset of 10. Now we need to databind this to our SPGRIDView.
Now remember there are a couple of things we need to do. We need to add a link to the name that links to the corresponding user profile page. We also need to take care of the Time stamp in the hire date. So here we go!!

Let me explain:
For the first Field I used a HyperLinkField.Notice that I Hardcoded the Url of the curent site. This might not be the way you want to do it, you can dynamically retreive this field. Notice the AccountName that is part of the object we created. It is mapped to the DataNavigateUrlFormatString. This is how you make that link Clickable!! I think the code speaks for itself. If you have questions on that let me know.
The second thing to note is line 101, It has a RowDataBoudn event!! this is for the formatting of the string in the hire date. THis event occurs just before it binds to the SPGridView whic is great because we want to format it before it is displayed.
The code for that Method is the following:

Unfortunately there is no way to index the fields by name. We have to index them by number. So I know that the cell indexed at 2 is my hire date field. So that's the one I format. The format is as follows, "month/day/year 10:12:12" SO all I did was leave the first part which is the date, and then take off the rest which is located after the first empty space.
You can do any type of formating you want here!
So that's it!! It seems like a lot of work or lots of things to think about. But that's SharePoint. I'm sure I've missed something here, so if you have any questions feel free to ask.
Good luck
Juan