I want to place an image into the Grid Column's Header instead of Caption Text at run time. I have seen how to do this at design time (https://www.youtube.com/playlist?list=PLDAFFE8C757FED32E). I attempted to translate this into dynamically creating this at run time, but I am missing something. How do I do this for the WebDataGrid?
Here is what is created during design time:
<Templates> <ig:ItemTemplate ID="WebDataGrid1Template1" runat="server" TemplateID="Comments"> <Template> <img src="images/Notes.png" alt="Comments" /> </Template> </ig:ItemTemplate> </Templates>
I tried to create it like this but it does not work (no image shows up):
Dim commentsHeader As Infragistics.Web.UI.ItemTemplate = New Infragistics.Web.UI.ItemTemplate() commentsHeader.TemplateID = "Comments" Dim commentsImage As System.Web.UI.WebControls.Image = New System.Web.UI.WebControls.Image() commentsImage.ImageAlign = ImageAlign.Middle commentsImage.AlternateText = "Comments" commentsImage.ImageUrl = "images/Notes.png" commentsHeader.Controls.Add(commentsImage) WebDataGrid1.Templates.Add(commentsHeader)
Thanks for your help.
I think I am missing something here.
The link you provided seems to be refering to how to handle things for if I want images in the column's rows, not the column header. The header of a column does not have an ItemTemplate but asks for a TemplateID instead. If I do what they suggest and creating a class that implements ITemplate, then I do not have a TemplateID that I can use to apply to the column header's property. Since I cannot set the TemplateID I am not able to apply it to a column.