11 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 11 Aug 2014, 09:53 AM
Hi Rahul,
Please take a look into the Programmatic Data Binding part of this online demo.
Thanks,
Princy.
Please take a look into the Programmatic Data Binding part of this online demo.
Thanks,
Princy.
0
Rahul
Top achievements
Rank 1
answered on 12 Aug 2014, 05:13 AM
Hi Princy,
Thank you for your quick responce.
I saw that example but I am not storing image URL, I am storing an Image in binary format, so is it possible to bind binary data to image gallery? we can do this for RAD image control but can we do the same for RAD image Gallery?
Thank you for your quick responce.
I saw that example but I am not storing image URL, I am storing an Image in binary format, so is it possible to bind binary data to image gallery? we can do this for RAD image control but can we do the same for RAD image Gallery?
0
Accepted
Princy
Top achievements
Rank 2
answered on 12 Aug 2014, 08:03 AM
Hi Rahul,
It is possible to bind RadImageGallery with binary data. Please have a look into the sample code snippet which works fine at my end.
ASPX:
C#:
Thanks,
Princy.
It is possible to bind RadImageGallery with binary data. Please have a look into the sample code snippet which works fine at my end.
ASPX:
<
telerik:RadImageGallery
ID
=
"RadImageGallery1"
runat
=
"server"
OnNeedDataSource
=
"RadImageGallery1_NeedDataSource"
DataDescriptionField
=
"Description"
DataImageField
=
"Picture"
DataTitleField
=
"CategoryName"
LoopItems
=
"true"
>
</
telerik:RadImageGallery
>
C#:
protected
void
RadImageGallery1_NeedDataSource(
object
sender, ImageGalleryNeedDataSourceEventArgs e)
{
RadImageGallery2.DataSource = GetDataTable();
}
public
DataTable GetDataTable()
{
string
query =
"SELECT [Picture], [Description], [CategoryName] FROM [Categories]"
;
String ConnString = ConfigurationManager.ConnectionStrings[
"ConnectionString"
].ConnectionString;
SqlConnection conn =
new
SqlConnection(ConnString);
SqlDataAdapter adapter =
new
SqlDataAdapter();
adapter.SelectCommand =
new
SqlCommand(query, conn);
DataTable dtImageGallery =
new
DataTable();
conn.Open();
try
{
adapter.Fill(dtImageGallery);
}
finally
{
conn.Close();
}
return
dtImageGallery;
}
Thanks,
Princy.
0
Rahul
Top achievements
Rank 1
answered on 12 Aug 2014, 10:01 AM
Thank you for your Help, I have implemented the same in my page and it works fine, but when I am tring to put this control inside RAD grid as a item template it is not working. so is it possible to add RAD image gallery conrol inside RAD Grid
0
Princy
Top achievements
Rank 2
answered on 13 Aug 2014, 03:20 AM
Hi Rahul,
Please have a look into the modified code snippet which works fine at my end.
ASPX:
C#:
Thanks,
Princy.
Please have a look into the modified code snippet which works fine at my end.
ASPX:
<
telerik:RadGrid
ID
=
"rgrdOrders"
runat
=
"server"
DataSourceID
=
"sqldsOrders"
>
<
MasterTableView
>
<
Columns
>
<
telerik:GridTemplateColumn
>
<
ItemTemplate
>
<
telerik:RadImageGallery
ID
=
"RadImageGallery2"
Height
=
"350px"
Width
=
"600px"
runat
=
"server"
OnNeedDataSource
=
"RadImageGallery1_NeedDataSource"
DataDescriptionField
=
"Description"
DataImageField
=
"Picture"
DataTitleField
=
"CategoryName"
LoopItems
=
"true"
RenderMode
=
"Auto"
Skin
=
"Metro"
>
<
ToolbarSettings
ShowSlideshowButton
=
"true"
ShowItemsCounter
=
"true"
ItemsCounterFormat
=
"Images {0} of {1}"
/>
<
ThumbnailsAreaSettings
ThumbnailWidth
=
"120px"
ThumbnailHeight
=
"80px"
Height
=
"80px"
/>
<
ImageAreaSettings
Height
=
"300px"
/>
<
ClientSettings
>
<
AnimationSettings
SlideshowSlideDuration
=
"4000"
>
</
AnimationSettings
>
</
ClientSettings
>
</
telerik:RadImageGallery
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"sqldsOrders"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [CategoryName] FROM [Categories]"></
asp:SqlDataSource
>
C#:
protected
void
RadImageGallery1_NeedDataSource(
object
sender, ImageGalleryNeedDataSourceEventArgs e)
{
RadImageGallery imageGallery = (RadImageGallery)sender;
imageGallery.DataSource = GetDataTable();
}
Thanks,
Princy.
0
Louis
Top achievements
Rank 1
answered on 04 Dec 2016, 08:47 AM
MAy I also have assistance with this
I have followed the suggestion solution for Need Data Source and am getting the following error. Also attached my code
0
Sreeram
Top achievements
Rank 1
answered on 05 Dec 2016, 05:03 AM
I have a rad grid with columns Album name,Created by.and records three are there.when i expand that album name,that nested view template (image gallery) will appears. that particular album name images from database should be bind to rad image gallery.that images are in binary format.what to do??? please help me guyzzzz...i want it immediately.please please
0
Sreeram
Top achievements
Rank 1
answered on 05 Dec 2016, 09:29 AM
What is the datatype of picture in database (SQL)...i have a column with datatype var binary in db,i am giving that column as a data imamge field,but it was not showing my pictures,please help me...and one more thing,with in that rad image gallery i want to put a template called media player.it,s not coming,showing design time error.i'm using 2014 version of telerik.is there any solution for that.please help me guys...please
0
Hi Sreeram,
The DataImageField will specify the field containing the binary data for the image, so if the RadImageGallery is bound correctly, the images should be displayed. Can you please share the configuration related to the RadImageGallery and the code related to the binding of the control, so we can have a better idea of the current implementation?
Looking forward to your reply.
Regards,
Konstantin Dikov
Telerik by Progress
The DataImageField will specify the field containing the binary data for the image, so if the RadImageGallery is bound correctly, the images should be displayed. Can you please share the configuration related to the RadImageGallery and the code related to the binding of the control, so we can have a better idea of the current implementation?
Looking forward to your reply.
Regards,
Konstantin Dikov
Telerik by Progress
Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
0
Sreeram
Top achievements
Rank 1
answered on 08 Dec 2016, 09:45 AM
Please See the image .you will understand my problem,,,
0
Hi Sreeram,
RadImageGallery support templates since Q1 2015, so if you need to use that functionality you need to upgrade to a newer version.
As for the binding problem, first thing that you should have in mind is that you need to set the DataSource only for the RadImageGallery that fires the OnNeedDataSource event. Traversing all data items is unnecessary. You can get reference to the current RadImageGallery through the event arguments:
If the images are not displayed correctly I would recommend that you test the RadImageGallery configuration outside RadGrid and use an existing album name for retrieving the data for the test control and see if the images will be displayed.
Looking forward to your reply with the result.
Best Regards,
Konstantin Dikov
Telerik by Progress
RadImageGallery support templates since Q1 2015, so if you need to use that functionality you need to upgrade to a newer version.
As for the binding problem, first thing that you should have in mind is that you need to set the DataSource only for the RadImageGallery that fires the OnNeedDataSource event. Traversing all data items is unnecessary. You can get reference to the current RadImageGallery through the event arguments:
RadImageGallery gallery = sender as RadImageGallery;
If the images are not displayed correctly I would recommend that you test the RadImageGallery configuration outside RadGrid and use an existing album name for retrieving the data for the test control and see if the images will be displayed.
Looking forward to your reply with the result.
Best Regards,
Konstantin Dikov
Telerik by Progress
Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.