2013-01-07 26 views
1

我正在使用Telerik Sitefinity 5.1。我已經建有3個字段{標題,URL,圖片}標題和URL模塊 - >串場 圖像 - > '圖像選擇'從Telerik Sitefinity模塊獲取圖像

的.cs

protected void Page_Load(object sender, EventArgs e) 
    {  
     var myCollection = GetDataItems(); 

     RadRotator1.DataSource = myCollection; 
     RadRotator1.DataBind(); 
    } 

    public IQueryable<DynamicContent> GetDataItems() 
    { 
     DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(); 
     Type brandLogosType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.BrandLogos.BrandLogos");   
     var myCollection = dynamicModuleManager.GetDataItems(brandLogosType).Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Visible == true); 

     return myCollection; 
    } 

asp.x

<telerik:RadRotator ID="RadRotator1" runat="server" RotatorType="AutomaticAdvance" 
BorderWidth="4px" Width="100px" Height="100px" ScrollDirection="Down"> 
<ItemTemplate> 
    <asp:Image runat="server" ID="image1" /> 
    <%-- <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("title") %>'></asp:Label>--%> 
    <asp:Image ID="img1" runat="server" ImageUrl='<%# Eval("UrlWithExtension") %>' /> 
</ItemTemplate> 

獲取titleurlText='<%# Eval("title") %>'但是不知道怎麼弄的圖像是這樣的。有人可以告訴我嗎?

在此先感謝。

回答

0

你好我已經解決了這個問題,通過在我們的自定義控制文件後面的代碼中創建一個函數,並在control.ascx文件中調用了該方法,我添加了一箇中繼器& asp.net圖像控件字段在此處顯示圖像是我的網站上的示例解決方案

Get Images in custom control from Custom module image asset field