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

How to add ListView to RadMultiPage

2 Answers 92 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Pablo
Top achievements
Rank 1
Pablo asked on 22 Jul 2008, 05:40 PM
Hello, I am doing a news site. In the homepage I have a RadTabStrip and a RadMultiPage. In code behind, I am calling business logic to get the news categories, and then I add one tab and one pagview to show the news for each category.  I don't have problems with creating the tabs and pageviews.  They are created ok, I even added a Textbox to each one of the pageviews showing the category titile. 

My problem is that I want to add a ListView, but I don't know how to create the ListView's childs programatically (layouttemplate, itemtemplate, etc), as a matter of fact it would seem a little bit odd to create those programmatically as they contain html markup.

I tried to create the ListView as a User Control in an ascx file, but then when I call it from my codebehind like this:

Dim

LVEstudios As ListView = Page.LoadControl("~/Resources/ListViewParaMultiPageEstudios.ascx")

I am getting this error in the line shown above:
Unable to cast object of type 'ASP.resources_listviewparamultipageestudios_ascx' to type 'System.Web.UI.WebControls.ListView'.

How can I tell the ascx file to be of type ListView ?  I think that would solve my problem.

My ascx file looks like this:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ListViewParaMultiPageEstudios.ascx.vb" 
    Inherits="Resources_ListViewParaMultiPageEstudios" %> 
 
<asp:ListView runat="server" ItemPlaceholderID="AquiVanItems">  
    <LayoutTemplate> 
        <asp:PlaceHolder ID="AquiVanItems" runat="server"></asp:PlaceHolder> 
    </LayoutTemplate> 
    <ItemTemplate> 
        <%#Eval("Nombre")%> 
        <br /> 
        <%#Eval("Orden")%> 
    </ItemTemplate> 
</asp:ListView> 
 

and its code behind:

 
Partial Class Resources_ListViewParaMultiPageEstudios  
    Inherits System.Web.UI.UserControl  
 
 
End Class 


Any ideas?  I hope I made myself clear.

2 Answers, 1 is accepted

Sort by
0
Pablo
Top achievements
Rank 1
answered on 22 Jul 2008, 07:18 PM
Ok I am binding the listview in the .ascx.vb file.
But how do I pass parameters?
0
Pablo
Top achievements
Rank 1
answered on 22 Jul 2008, 08:36 PM
Nevermind, I solved it.
Tags
TabStrip
Asked by
Pablo
Top achievements
Rank 1
Answers by
Pablo
Top achievements
Rank 1
Share this question
or