473,625 Members | 2,677 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what does RegisterRequire sPostBack REALLY do??

Sam
According to "Developing Microsoft ASP.NET Server Controls and
Components", a control can get the LoadPostData event by using
RegisterRequire sPostBack, even if its UniqueID does not match that of
the Forms collection.

In the code below, I've tried doing this on a Page instead of a
regular control. However, it doesn't work. The LoadPostData is never
fired, even on postback. Does anyone have any idea why? How could I
make it work for a Page without having to put its UniqueID in the
Forms collection?

As an aside, the Page.ID remained null, even as late as OnPreRender
(that's why I assigned it in OnInit). Does anyone have any ideas
about this as well?

Thanks!!!

-Sam

public class Test : System.Web.UI.P age, IPostBackDataHa ndler
{
protected Button test;

override protected void OnInit(EventArg s e)
{
this.ID = "page";
test.Text = "Click Me!";
test.Click += new EventHandler(Te st_Click);
base.OnInit(e);
}

protected override void OnPreRender(Eve ntArgs e)
{
Page.RegisterRe quiresPostBack( this);
base.OnPreRende r (e);
}

public void RaisePostDataCh angedEvent()
{
}

public bool LoadPostData(st ring postDataKey,
System.Collecti ons.Specialized .NameValueColle ction postCollection)
{
return false;
}

private void Test_Click(obje ct sender, EventArgs e)
{
test.Text = "Clicked!";
}
}
Nov 18 '05 #1
1 1726
It doesn't work for Page, because it is Page itself controlling the postback
data loading for controls. It never tries to to call
IPostBackDataHa ndler.LoadPostD ata for itself.

RegisterRequire sPostBack adds the UniqueId of the control to the list of
controls that require postback data handling. At postback it tries to locate
the controls matching this list and call their IPostBackDataHa ndler
implementation (however, it searches from Page's child controls, therefore
Page itself cannot be found).

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Sam" <sa*******@yaho o.com> wrote in message
news:1a******** *************** ***@posting.goo gle.com...
According to "Developing Microsoft ASP.NET Server Controls and
Components", a control can get the LoadPostData event by using
RegisterRequire sPostBack, even if its UniqueID does not match that of
the Forms collection.

In the code below, I've tried doing this on a Page instead of a
regular control. However, it doesn't work. The LoadPostData is never
fired, even on postback. Does anyone have any idea why? How could I
make it work for a Page without having to put its UniqueID in the
Forms collection?

As an aside, the Page.ID remained null, even as late as OnPreRender
(that's why I assigned it in OnInit). Does anyone have any ideas
about this as well?

Thanks!!!

-Sam

public class Test : System.Web.UI.P age, IPostBackDataHa ndler
{
protected Button test;

override protected void OnInit(EventArg s e)
{
this.ID = "page";
test.Text = "Click Me!";
test.Click += new EventHandler(Te st_Click);
base.OnInit(e);
}

protected override void OnPreRender(Eve ntArgs e)
{
Page.RegisterRe quiresPostBack( this);
base.OnPreRende r (e);
}

public void RaisePostDataCh angedEvent()
{
}

public bool LoadPostData(st ring postDataKey,
System.Collecti ons.Specialized .NameValueColle ction postCollection)
{
return false;
}

private void Test_Click(obje ct sender, EventArgs e)
{
test.Text = "Clicked!";
}
}

Nov 18 '05 #2

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

Similar topics

92
6434
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption? cheers, reed
125
14690
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
7
1805
by: steve bull | last post by:
I have the following code snippet to read the colorRange attributes for the colorRangeSwatch in the xml file listed below. string expr = "/swatches/colorRangeSwatch/colorRange"; XmlElement crsElement = (XmlElement)m_colorRangeSwatchDoc.SelectSingleNode(expr); bool fr = bool.Parse(crsElement.GetAttribute("fixed").ToString()); The element returned is always the 1st, All Blue Colors, why doesn't the expression...
44
4197
by: lester | last post by:
a pre-beginner's question: what is the pros and cons of .net, compared to ++ I am wondering what can I get if I continue to learn C# after I have learned C --> C++ --> C# ?? I think there must be many know the answer here. thanks
35
3320
by: GTO | last post by:
I do not believe that C# is the future of C++. I also do not believe that adding two thousand new library functions to the standard library is the future of C++. But what is the future of C++? Is it as good as a programming language can get? Like so many of you, I programmed speech recognizers, image recognition systems, a portion of a chess program, lots of numeric code using STL, and tons of other applications in C++, (even firmware...
121
10011
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
24
2767
by: Bob Alston | last post by:
Most of my Access database implementations have been fairly small in terms of data volume and number of concurrent users. So far I haven't had performance issues to worry about. <knock on wood> But I am curious about what techniques those of you who have done higher volume access implementations use to ensure high performance of the database in a multi-user 100mbps LAN implementation??? Thanks
21
13816
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered by Sets. - ICollection cannot decide containment - IList promises indexability by the natural numbers, which is not achievable (since i hash elements, not sort them). - IDictionary is definatly not setlike. Although I can, of course, define...
13
5032
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
0
8253
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8692
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8354
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.