I would like to create a page in the fashion of your demo shown in http://demos.telerik.com/aspnet-ajax/controls/examples/integration/raduploadinajaxifiedgrid/defaultcs.aspx?product=binaryimage
I have made a slight change, and do not know how to adjust the VB code to compensate for it.
I have changed the code below from :
<telerik:GridBinaryImageColumn DataField="Data" HeaderText="Image" UniqueName="Upload" ImageAlign="NotSet"
ImageHeight="80px" ImageWidth="80px" ResizeMode="Fit" DataAlternateTextField="Description"
DataAlternateTextFormatString="Image of {0}">
<HeaderStyle Width="10%" />
</telerik:GridBinaryImageColumn>
to the following code:
The problem I am having is with the VB code below that is in bold and Italics. How do I change this code to work with the GridTemplateColumn, instead of the Gridbinaryimagecolumn?
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)
If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
Dim upload As RadUpload = DirectCast(editItem.EditManager.GetColumnEditor("Upload"), GridBinaryImageColumnEditor).RadUploadControl
RadAjaxPanel1.ResponseScripts.Add(String.Format("window['UploadId'] = '{0}';", upload.ClientID))
End If
End Sub
Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs)
If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
Dim upload As RadUpload = DirectCast(editItem.EditManager.GetColumnEditor("Upload"), GridBinaryImageColumnEditor).RadUploadControl
Dim validator As CustomValidator = New CustomValidator()
validator.ErrorMessage = "Please select file to be uploaded"
validator.ClientValidationFunction = "validateRadUpload"
validator.Display = ValidatorDisplay.Dynamic
DirectCast(upload.Parent, TableCell).Controls.Add(validator)
End If
End Sub
I have made a slight change, and do not know how to adjust the VB code to compensate for it.
I have changed the code below from :
<telerik:GridBinaryImageColumn DataField="Data" HeaderText="Image" UniqueName="Upload" ImageAlign="NotSet"
ImageHeight="80px" ImageWidth="80px" ResizeMode="Fit" DataAlternateTextField="Description"
DataAlternateTextFormatString="Image of {0}">
<HeaderStyle Width="10%" />
</telerik:GridBinaryImageColumn>
to the following code:
<
telerik:GridTemplateColumn >
<ItemTemplate>
<telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" DataValue = '<%# Eval("Document") %>' ResizeMode = "Fit" Height="150px" Width="150px" />
<telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="radBinaryImage1" Position="Center">
<telerik:RadBinaryImage ID="RadBinaryImage2" runat="server" DataValue = '<%# Eval("Document") %>' ResizeMode = "Fit" Height="800px" Width="600px" />
</telerik:RadToolTip>
</ItemTemplate>
</telerik:GridTemplateColumn>
The problem I am having is with the VB code below that is in bold and Italics. How do I change this code to work with the GridTemplateColumn, instead of the Gridbinaryimagecolumn?
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)
If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
Dim upload As RadUpload = DirectCast(editItem.EditManager.GetColumnEditor("Upload"), GridBinaryImageColumnEditor).RadUploadControl
RadAjaxPanel1.ResponseScripts.Add(String.Format("window['UploadId'] = '{0}';", upload.ClientID))
End If
End Sub
Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs)
If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
Dim upload As RadUpload = DirectCast(editItem.EditManager.GetColumnEditor("Upload"), GridBinaryImageColumnEditor).RadUploadControl
Dim validator As CustomValidator = New CustomValidator()
validator.ErrorMessage = "Please select file to be uploaded"
validator.ClientValidationFunction = "validateRadUpload"
validator.Display = ValidatorDisplay.Dynamic
DirectCast(upload.Parent, TableCell).Controls.Add(validator)
End If
End Sub