DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sat, 4 Aug 2007 21:14:00 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    liuxinfeihu


How realizes the postback event in the cache page   
Hi,
I use post way realization page postback this am must,How realizesunder the 
post way controls postback continuously to be unable to findthe solution the 
method to hope can obtain master's help in here

Cannotuse VaryByControl

 
code:
<%@ OutputCache Duration="100000" VaryByParam="page;category"  %>
 <%= DateTime.Now.ToString() %>
      <asp:Button ID="button1" runat=server Text="click" 
OnClick="Button1_Click" />
      <asp:Label ID="label1" runat=server></asp:Label>
 
protected void Button1_Click(object sender, EventArgs e)
    {
        this.label1.Text = DateTime.Now.ToString();
    }
 
 
i have used other codes cannot realize:
 protected void Page_Load(object sender, EventArgs e)
    {       
        ClientScriptManager cs = Page.ClientScript;

        // Create a button element with its onClick attribute defined
        // to create a postback event reference to the custom label control.
        HtmlInputButton b = new HtmlInputButton();
        b.ID = "mybutton1";
        b.Value = "Click";
        b.Attributes.Add("onclick", cs.GetPostBackEventReference(this, 
b.ID.ToString()));
        PlaceHolder1.Controls.Add(b);
        PlaceHolder1.Controls.Add(new LiteralControl("<br/>"));

        HtmlInputButton c = new HtmlInputButton();
        c.ID = "mybutton2";
        c.Value = "Click";
        c.Attributes.Add("onclick", cs.GetPostBackEventReference(this, 
c.ID.ToString()));
        PlaceHolder1.Controls.Add(c);
        PlaceHolder1.Controls.Add(new LiteralControl("<br/>"));

        // Create a link element with its href attribute defined
        // to create a postback event reference to the custom label control.
        HtmlAnchor a = new HtmlAnchor();
        a.ID = "myanchor1";
        a.InnerText = "link";
        a.HRef = cs.GetPostBackClientHyperlink(this, a.ID.ToString());
        PlaceHolder1.Controls.Add(a);        
    }
    void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
    {
        Label1.Text = "Postback handled by " + this.ID.ToString() + ". 
<br/>" +
                      "Postback caused by " + eventArgument.ToString() + 
"."; ;
    }
Date:Sat, 4 Aug 2007 21:14:00 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us