Re: How to send variables to be used in a class?
- From: MattB <somedudeus@xxxxxxxxx>
- Date: Wed, 12 Oct 2005 15:26:05 -0600
Shapper wrote:
Hello,
How can I use a var1 and var2 in class ItemTemplate?
Basically, I need var1 and var2 which are declared on page load to be avalaible in Class ItemTemplate when it's called.
Public Class webform
Inherits System.Web.UI.Page ... Private Sub Page_Load(...) Handles MyBase.Load ... Dim var1 As String = "A" Dim var2 As String = "B" column.ItemTemplate = CreateItemTemplate() ... End Sub
Function CreateItemTemplate() As ITemplate Return New ItemTemplate End Function
End Class
Class ItemTemplate ... End Class
Thanks, Miguel
Unless I'm not understanding you right, I think it may be as simple as this:
Public Class webform
Inherits System.Web.UI.Page ... Private Sub Page_Load(...) Handles MyBase.Load ... Dim var1 As String = "A" Dim var2 As String = "B" column.ItemTemplate = CreateItemTemplate(var1, var2) ... End Sub
Function CreateItemTemplate(ByVal var1 as String, ByVal var2 as string) As ITemplate
Return New ItemTemplate
End Function
End Class
Class ItemTemplate ... End Class ------------
Keep in mind the local names inside CreateItemTemplate are arbitrary and don't need to match the ones being passed in (var1 and var2).
HTH,
Matt .
- Prev by Date: Calendar Control & finding out if a date IsSelectable
- Next by Date: Re: ASP.NET WebSite: Permission Issue
- Previous by thread: Calendar Control & finding out if a date IsSelectable
- Next by thread: Re: ASP.NET WebSite: Permission Issue
- Index(es):
Relevant Pages
|