Hi all,
i am trying to add one ASPXGridView Column using DevExpress in server side of vb.net .
the column i have added successfully but i cannot add DataItemTemplate.
if am trying to add below code then i am getting below error,
So please drop me any solution.
Error:
Unable to cast object of type 'System.String' to type 'System.Web.UI.ITemplate'
My code is :
colText = New DevExpress.Web.ASPxGridView.GridViewDataTextColumn
colText.FieldName = "Image"
colText.Caption = "Image"
colText.VisibleIndex = "16"
colText.DataItemTemplate = "<a href='javascript:void(0);' onclick='OnMoreInfoClick(this, '<%# Container.KeyValue %>')'>ShowImage</a>" // here am getting above error
colText.CellStyle.HorizontalAlign = HorizontalAlign.Right
colText.CellStyle.Border.BorderColor = Drawing.Color.DarkBlue
colText.CellStyle.Border.BorderStyle = BorderStyle.Double
colText.EditFormCaptionStyle.HorizontalAlign = HorizontalAlign.Right
colText.CellStyle.VerticalAlign = VerticalAlign.Middle
colText.CellStyle.HorizontalAlign = HorizontalAlign.Right
If Page.IsPostBack = False Then
Grid.Columns.Add(colText)
End If
thanks in advance