I need to add a Template Column containing an image to a grid programmatically at Page Load time. I have successfully added the column in the .aspx file, but do not know how to add the column in the code-behind file (using visual basic). Here's the code for the .aspx file that I want to add:
Can anyone tell me how to add this same column in the Page Load event in the code behind file? I have added data bound columns and hyperlinks (see code below), but don't know how to define the template column programmatically.
Thanks in advance for any help!
Lynn
<MasterTableView NoMasterRecordsText="" AutoGenerateColumns="False" > |
<Columns> |
<telerik:GridTemplateColumn UniqueName="ImageFile" Groupable="False"> |
<HeaderStyle ></HeaderStyle> |
<ItemStyle HorizontalAlign="Center" ></ItemStyle> |
<ItemTemplate> |
<asp:Image ID="ImportantImage" Height="40px" BorderWidth="0px" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "ImagePath") %>' AlternateText="Picture" runat="server" /> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
</Columns> |
</MasterTableView> |
hypercolumn = New GridHyperLinkColumn |
Me.RadGrid1.Columns.Add(hypercolumn) |
hypercolumn.HeaderText = "Edit Rec." |
hypercolumn.Text = "Edit" |
hypercolumn.DataNavigateUrlFields = New String() {"Item"} |
hypercolumn.DataNavigateUrlFormatString = "~/ItemEdit.aspx?K={0}" |
hypercolumn.UniqueName = "EditRec" |
hypercolumn = Nothing |
Lynn