This is a migrated thread and some comments may be shown as answers.

Show multiple fields in description box in telerik image gallery

1 Answer 115 Views
ImageGallery
This is a migrated thread and some comments may be shown as answers.
mustufain
Top achievements
Rank 1
mustufain asked on 18 Apr 2016, 02:05 PM

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:RadStyleSheetManager>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js">
                </asp:ScriptReference>
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        </telerik:RadAjaxManager>
    <div>
    
    </div>
       
        <telerik:RadImageGallery ID="RadImageGallery1"  OnNeedDataSource="RadImageGallery1_NeedDataSource" runat="server" AppendDataBoundItems="True"   DataImageField="picture" DataTitleField="name" LoopItems="True">
        </telerik:RadImageGallery>

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;

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 21 Apr 2016, 11:03 AM
Hello,

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.

Regards,
Viktor Tachev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
ImageGallery
Asked by
mustufain
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or