Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Closed Issue: LoadControl Issue [27259]

$
0
0
I have also added this to StackOverFlow: http://stackoverflow.com/questions/12313115/trying-to-loadcontrol-to-an-tabpanel-in-ajaxtoolkit


I am trying to LoadControl into a Tab with AjaxToolKit TabContainer.

Heres the code:

Dim newTab As New AjaxControlToolkit.TabPanel
newTab.ID = "Tab4"
newTab.HeaderText = "Tab 4"
tbs.Tabs.Add(newTab)
Dim mtCtl As UserControl = TemplateControl.LoadControl("Tweets.ascx")
mtCtl.Attributes.Add("ScreenName", "CherylCole")
newTab.ContentTemplate = mtCtl
This is the code in Tweets.ascx.vb

Partial Class Tweets
Inherits System.Web.UI.UserControl


Dim db As New LINQTwitterDataContext
Dim _ScreenName As String = "CherylCole"
Public Sub Statuses(ByVal screename As String)
Dim tweets = (From s In db.statuses Where s.screen_name = _ScreenName Order By s.statusid Descending).Take(10)
Dim a = tweets
GridView1.DataSource = tweets
GridView1.DataBind()
End Sub

Sub New()

End Sub

Sub New(ByVal screenname As String)

_ScreenName = screenname
End Sub

Public Property ScreenName(ByVal Name As String) As String
Get
Return _ScreenName
End Get
Set(ByVal value As String)
_ScreenName = value
End Set
End Property
End Class

And within Tweets.ascx

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Tweets.ascx.vb" Inherits="Tweets" %>
When I load without parameters using LoadTemplate, no problems straight in but I am getting Exception with LoadControl (Unable to cast object of type 'ASP.tweets_ascx' to type 'System.Web.UI.ITemplate'.)

Please help!!


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>