473,394 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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() +
"."; ;
}

Aug 5 '07 #1
0 1363

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rob | last post by:
Each time a webform is posted back (submitted), another URL is added to the browser's history list. My web application allows a back button to return to previously visited pages, but I do not wish...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
5
by: John W | last post by:
Hello, I have been wondering that everytime I do a submit on a button/form (postback) it is using the same webform on the CS, how do I goto another webform once I have done a postback and...
5
by: Darrel | last post by:
I'm dimming a string at the top of my page so I can use it in several different subs on the page. I'm setting the text in one sub and then reading it in several. I'd like to also use this...
3
by: Ed Chiu | last post by:
Hi, I plan to use panel to store multiple HTML text in a web form page, here is the code snippet that add HTML into panel: Dim lit1 As New Literal lit1.Text = strHTML...
11
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be...
2
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite...
1
by: ajfish | last post by:
Hi, In my asp.net 1.1 web application there is a page with a url something like userinfo.aspx?userid=107 which has some postback buttons on it. In the GET method (i.e. IsPostBack = false) it...
0
by: Madhur | last post by:
Hello I am using a custom SqlSiteMapProvider which I am holding in the Cache object. There is an Update button which removes the item from the cache, so that when next time BuildSiteMap() is...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.