Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > User control caching

Reply
Thread Tools

User control caching

 
 
Liverpool fan
Guest
Posts: n/a
 
      05-10-2006
I have a simple user control that consists of a lebel and a dropdown
list that I am using for page navigation. I want to cache this control
so that it is reused between pages, however when I add the OutputCache
directive, the control no longer responds to events What am I doing
wrong?

<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="AssetType.ascx.vb" Inherits="AssetRegister.AssetType"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ OutputCache Duration="60" VaryByParam="None" Shared="None" %>

Public Class AssetType
Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents ddlAssetType As
System.Web.UI.WebControls.DropDownList

'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Try
If Not Me.IsPostBack Then
Me.ddlAssetType.SelectedValue =
Me.Session("AssetType").ToString
End If
Catch ex As Exception

End Try
End Sub

Private Sub ddlAssetType_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ddlAssetType.SelectedIndexChanged
Dim sPage As String = ""
Dim sAssetType As String = ""

Select Case Me.ddlAssetType.SelectedValue
Case "PC's"
sPage = "PCs.aspx"
sAssetType = "PC's"
Case "Notebooks"
sPage = "Notebooks.aspx"
sAssetType = "Notebooks"
Case "Servers"
sPage = "Servers.aspx"
sAssetType = "Servers"
Case "Printers - Windows"
sPage = "PrintersWin.aspx"
sAssetType = "Printers - Windows"
Case "Printers - GSM"
sPage = "PrintersGSM.aspx"
sAssetType = "Printers - GSM"
Case "Printers - Local"
sPage = "PrintersLocal.aspx"
sAssetType = "Printers - Local"
Case "Mobiles"
sPage = "UserMobiles.aspx"
sAssetType = "Mobiles"
Case "Multiplexors"
sPage = "Multiplexors.aspx"
sAssetType = "Multiplexors"
Case "Miscellaneous"
sPage = "Misc.aspx"
sAssetType = "Miscellaneous"
End Select

If sPage <> "" AndAlso sAssetType <> "" Then
Me.Session("AssetType") = sAssetType
Me.Response.Redirect(sPage)
End If

End Sub
End Class

 
Reply With Quote
 
 
 
 
Liverpool fan
Guest
Posts: n/a
 
      05-10-2006
Shared = "True" still prroduces the same result.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
Disable page caching without disabling caching of jpegs andstylesheets etc JimLad ASP .Net 3 01-21-2010 10:13 AM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
Fragment Caching inside page caching? Troy Simpson ASP .Net 0 01-19-2004 11:57 AM
trouble with caching or caching the trouble Hypo ASP .Net 6 08-01-2003 07:11 AM



Advertisments