Show multiple fields in description box in telerik image gallery

2 posts, 0 answers
  1. mustufain
    mustufain avatar
    1 posts
    Member since:
    Apr 2016

    Posted 18 Apr Link to this post

    Hello i am using telerik image gallery to shows the images. I am fetching images from database. I want add multiple column to the description box as to give information about the image . However it is throwing me an error. Can you please help me in this regard. Below is my code.

    This is my telerik image gallery control:

        <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js">
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js">
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js">
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <telerik:RadImageGallery ID="RadImageGallery1"  OnNeedDataSource="RadImageGallery1_NeedDataSource" runat="server" AppendDataBoundItems="True"   DataImageField="picture" DataTitleField="name" LoopItems="True">

    Belowin my C# code:

     RadImageGallery1.DataSource = GetDataTable();
                DataTable table = GetDataTable(); ;
                string price = table.Rows[0]["price"].ToString();
                string size=table.Rows[0]["size"].ToString();
                string place = table.Rows[0]["place"].ToString();
                string description = "Price: " + price + " " + "Size: " + size + " " + "Place: " + place;
                RadImageGallery1.DataDescriptionField = description;

  2. Viktor Tachev
    Viktor Tachev avatar
    1445 posts

    Posted 21 Apr Link to this post


    Note that the DataDescriptionField property should point to a field in the data source of the ImageGallery. In order to implement the described behavior you can add a Description field to the DataTable. When you retrieve the data and populate the DataTable you should retrieve the values from multiple fields and set that as value to the Description field.

    Viktor Tachev
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft R3 2016 release webinar banner
Back to Top