I am creating a grid programmatically:
and am creating the columns with the following code:
I would like to get the DocumentType data bound column and replace the text with an image based on what that text is. Any ideas on how I go about approaching this?
Thanks,
Michael
| RadGrid gridFileView = new RadGrid(); |
| gridFileView.ID = gridFileViewID; |
| gridFileView.Skin = "Vista"; |
| gridFileView.AllowPaging = true; |
| gridFileView.PageSize = 20; |
| gridFileView.AllowSorting = true; |
| gridFileView.ClientSettings.AllowRowsDragDrop = true; |
| gridFileView.ClientSettings.Selecting.AllowRowSelect = true; |
| pnlFileView.Controls.Add(gridFileView); |
| AddExistingFiles(gridFileView, docs); |
and am creating the columns with the following code:
| private static void AddExistingFiles(RadGrid gridFileView, ExternalDocuments docs) |
| { |
| // Bind files to grid |
| gridFileView.DataSource = docs; |
| gridFileView.AutoGenerateColumns = false; |
| gridFileView.MasterTableView.DataKeyNames = new string[] { "Guid" }; |
| AddGridRow(gridFileView); |
| gridFileView.DataBind(); |
| } |
| private static void AddGridRow(RadGrid gridFileView) |
| { |
| GridBoundColumn boundColumn; |
| boundColumn = new GridBoundColumn(); |
| boundColumn.DataField = "DocumentType"; |
| boundColumn.HeaderText = "Type"; |
| gridFileView.MasterTableView.Columns.Add(boundColumn); |
| boundColumn = new GridBoundColumn(); |
| boundColumn.DataField = "Uploaded"; |
| boundColumn.HeaderText = "Date added"; |
| gridFileView.MasterTableView.Columns.Add(boundColumn); |
| boundColumn = new GridBoundColumn(); |
| boundColumn.DataField = "Title"; |
| boundColumn.HeaderText = "Title"; |
| gridFileView.MasterTableView.Columns.Add(boundColumn); |
| boundColumn = new GridBoundColumn(); |
| boundColumn.DataField = "Filename"; |
| boundColumn.HeaderText = "File"; |
| gridFileView.MasterTableView.Columns.Add(boundColumn); |
| boundColumn = new GridBoundColumn(); |
| boundColumn.DataField = "Description"; |
| boundColumn.HeaderText = "Description"; |
| boundColumn.AllowSorting = false; |
| gridFileView.MasterTableView.Columns.Add(boundColumn); |
| boundColumn = new GridBoundColumn(); |
| boundColumn.DataField = "FileSize"; |
| boundColumn.HeaderText = "File size"; |
| boundColumn.AllowSorting = false; |
| gridFileView.MasterTableView.Columns.Add(boundColumn); |
| } |
I would like to get the DocumentType data bound column and replace the text with an image based on what that text is. Any ideas on how I go about approaching this?
Thanks,
Michael