HighTechTalks DotNet Forums  

User Control Caching - Details

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss User Control Caching - Details in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Vladkoag
 
Posts: n/a

Default User Control Caching - Details - 02-01-2005 , 09:43 AM






Sorry, maybe my previous question was rather confusing.

************************************
I have User Control:
[uc_button.ascx]

<%@ OutputCache Duration=60 VaryByparam="none" %>
<%@ Control Language="vb" ... %>
<asp:Button id="btnButtonCached" Text="Cached Button"
runat="server"></asp:Button>

************************************
I added this User Control to my WebForm and I want to add handler to the
button.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim m As Control
m = LoadControl("uc_button.ascx")

PlaceHolder1.Controls.Add(m)

If TypeOf m Is uc_button Then
AddHandler CType(m, uc_button).btnButtonCached.Click, AddressOf btnKlik
Else
If TypeOf m Is PartialCachingControl Then
If Not CType(m, PartialCachingControl).CachedControl Is Nothing Then
AddHandler CType((CType(m, PartialCachingControl)).CachedControl,
uc_button).btnButtonCached.Click, AddressOf btnKlik
End If
End If
End If

End Sub



Problem is that after first postback, CachedControl is Nothing, so no
handler is added. What is wrong there?

Thanks!

Vlado


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.