473,804 Members | 3,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

child control button click postback problem

All:

I have a page with a form and fields on the form (checkboxes, grids,
etc).
This form contains a usercontrol which has a dynamic navigational menu
of buttons.
When a user clicks on one of the buttons in the usercontrol, it is
intended to save the updates information on the parent form. This is
done using a delegate/callback function to save the data. The
callback works great, and the save method is called on the parent
page.

However, I have a problem. When the usercontrol button is clicked,
the latest data in the parent form is not there (it is the data loaded
from the database, not the changed data). All of the controls are
like this (checkboxes, textboxes, etc).

I've tried changing the order of when the callback occurs to see if
the page lifecycle has anything to do with it, but no luck. I have a
save button on the parent form, which does almost the same behavior
and works perfectly.

Is the issue that the usercontrol cannot see postback data, or that I
have to do something explicit to post it to be seen by the user
control?

Sample of the code, with usercontrol displayed (uc1:pagesideme nu):
>>>
<body background=".\i mages\Left_Grad ient.gif"
MS_POSITIONING= "GridLayout ">
<form id="frmBusiness NameAddr" method="post" runat="server">
<uc1:pagehead er id="PageHeader1 " runat="server"> </uc1:pageheader>
<table cellSpacing="0" cellPadding="0" width="100%">
<tr>
<td vAlign="top" width="100">
<uc1:pagesideme nu id="PageSideMen u1" runat="server"> </
uc1:pagesidemen u>
</td>
<<<

Thanks in advance for any insight,
pearcewg

Mar 18 '07 #1
3 5146

Not sure what the answer is, but as an alternative, can you not use
viewstate ?

"pearcewg" <pe******@gmail .comwrote in message
news:11******** *************@l 75g2000hse.goog legroups.com...
All:

I have a page with a form and fields on the form (checkboxes, grids,
etc).
This form contains a usercontrol which has a dynamic navigational menu
of buttons.
When a user clicks on one of the buttons in the usercontrol, it is
intended to save the updates information on the parent form. This is
done using a delegate/callback function to save the data. The
callback works great, and the save method is called on the parent
page.

However, I have a problem. When the usercontrol button is clicked,
the latest data in the parent form is not there (it is the data loaded
from the database, not the changed data). All of the controls are
like this (checkboxes, textboxes, etc).

I've tried changing the order of when the callback occurs to see if
the page lifecycle has anything to do with it, but no luck. I have a
save button on the parent form, which does almost the same behavior
and works perfectly.

Is the issue that the usercontrol cannot see postback data, or that I
have to do something explicit to post it to be seen by the user
control?

Sample of the code, with usercontrol displayed (uc1:pagesideme nu):
>>>>
<body background=".\i mages\Left_Grad ient.gif"
MS_POSITIONING= "GridLayout ">
<form id="frmBusiness NameAddr" method="post" runat="server">
<uc1:pagehead er id="PageHeader1 " runat="server"> </uc1:pageheader>
<table cellSpacing="0" cellPadding="0" width="100%">
<tr>
<td vAlign="top" width="100">
<uc1:pagesideme nu id="PageSideMen u1" runat="server"> </
uc1:pagesidemen u>
</td>
<<<

Thanks in advance for any insight,
pearcewg

Mar 18 '07 #2
I'm still looking, no solution yet.

I think it comes down to this question:
When a dynamically generated button in a user control is clicked, it
causes the user control to update, with updated viewstate.
How do I get the parent page to update viewstate?
Is there a way to specify the usercontrol to update parent page
viewstate, through creation or invokation or something similar?
Could raising a bubbled event fix this problem (technically, I don't
need the user control to do this work...I just want the parent page to
save it's posted data back).

Has anyone else has this problem:
UserControl contains dynamic buttons, which when clicked, lose
viewstate/data changes on parent form of usercontrol.

Mar 18 '07 #3
Just to followup:

I've re-learned that UserControls in asp.net have their own viewspace,
separate from the parent which contains them. As a result, a postback
of the usercontrol does not cause a postback of the parent.
I can understand this design, and will work with it, but it seems a
little strange that I am going to implement the following workaround.

I've gone ahead and removed the UserControl, and places the instance
code into each page that contains the usercontrol. It feels
good...going back all the way to 1985.

For my own long term lessons, if anyone out there knows of a solution
for this problem, please post it...

Thanks,
pearcewg

Mar 21 '07 #4

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

Similar topics

2
2229
by: Juan Romero | last post by:
Hey guys, I am working on a web custom control that basically draws a table (ASP Table) with a few child controls in the cells. I have a command button inside one of these cells. The problem I am running into is that I cannot get the click event of this object handled. I have tried wiring the event with "AddHandler" among other things and that seems not to work neither.
6
1685
by: Angel | last post by:
I have a button, combo, and custom control that i created. When I click the button i want to set certain display properties of my custom control depending whats in the combo. I set those properties in the Click_Event in the button control. Unfortunately postback is triggered in the click event before I set the display properties of the control. Is there anyway that I can set these properties before the postback is triggered? I'd like to do this...
1
11591
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 http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
2
2310
by: Roman | last post by:
I have built a simple user control that contains 2 buttons, a text box and a dropdownlist. When a button is clicked it sets the visible property of the textbox/dropdownlist and the button. ie the buttons allow me to toggle between the textbox and the dropdownlist. This works fine when the control is placed on the page but when it is placed inside a datalist, ie the itemtemplate, the onclick events for the buttons fire but the visibility...
1
2158
by: Steve Booth | last post by:
I have a web form containing a button that when selected adds a user control to a place holder. The user control contains a button. The first time the user control is added the contained button fires Click event first time it is selected. The second (andd successive) times the user control is added the button Click event does not fire the first time, only on the second and successive times. This problem is caused by the naming of the...
15
4782
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update button will verify the information that has been entered and updates the data base if the data is correct. Update will throw an exception if the data is not validate based on some given rules. I also have a custom error handling page to show the...
0
1889
by: Bruin | last post by:
Hi All, I'm having a problem with MDI child forms when the reference to the MDI Parent is set in a Control library. (Sorry for the long post) I have an control library assembly which holds all of my base classes including my base MDI Container form and my base MDI child form the mdi container has a singleton which returns an
7
3115
by: Siv | last post by:
Hi, I have an MDI application that uses a generic "ShowPage" routine in a module that is called when I want to display a child form. The basic idea is that in the module I have declared each form as follows: Friend F0 As frmMain Friend F1 As frmStart Friend F2 As frmSearch Then in my ShowPage routine (which is passed a string "pageToShow" which is the name of the form I wish to open), I first check to see if we already have an instance...
1
7597
by: jelle.huygen | last post by:
Hello, I have a problem in ASP.NET 2.0 with the viewstate of my dynamically added user control. I have reproduced the problem with a very simple user control and a very simple page. On my usercontrol is a button and a label. Everytime the button is clicked a counter which is stored in the viewstate is increased and displayed in the label.
2
15076
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have been able to find the cause of the problem, and will describe it here first textually and then through a code example. The purpose of what I am trying to do is to create a postback-free web application through the use of ASP.net AJAX UpdatePanels...
0
9704
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...
1
10302
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
10069
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
9130
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...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
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
5503
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...
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2975
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.