473,385 Members | 1,813 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,385 software developers and data experts.

Eventhandler in dynamically loaded and bound controls

Hi there,

in my website I'm buildung the whole page by loading webusercontrols
dynamically using Page.LoadControl("~..."). Within these webusercontrols, I'm
using asp.net controls such as the (old) DataGrid. Since the whole page has
to "rebuild" any time a postback was invoked, i have to rebind the grid any
time before I can react to some of the events that have been fired by a
rowitem like a linkbutton with commandName - so this worked on asp.net 1.1!

After migration to asp.net 2.0, the eventhandlers for the Grid.ItemCommand
doesn't get any events that have been fired by controls that have been
clicked on and initiated the eventhandler.

Do you have any ideas what i can do to get "the old strategy" working?

Thanks a lot!

Jan 17 '08 #1
2 1197

"Christian Robert Schulz" <Ch*******************@discussions.microsoft.com >
wrote in message news:A1**********************************@microsof t.com...
Hi there,

in my website I'm buildung the whole page by loading webusercontrols
dynamically using Page.LoadControl("~..."). Within these webusercontrols,
I'm
using asp.net controls such as the (old) DataGrid. Since the whole page
has
to "rebuild" any time a postback was invoked, i have to rebind the grid
any
time before I can react to some of the events that have been fired by a
rowitem like a linkbutton with commandName - so this worked on asp.net
1.1!

After migration to asp.net 2.0, the eventhandlers for the Grid.ItemCommand
doesn't get any events that have been fired by controls that have been
clicked on and initiated the eventhandler.

Do you have any ideas what i can do to get "the old strategy" working?

Thanks a lot!
I believe you need to create the controls in the Page_Init. Once you have
done this the page life cycle will get the values from the ViewState and you
should be good to go.

Hope this helps
Lloyd Sheen

Jan 17 '08 #2
Hi Lloyd,

thanks for your posting - this gave me the keywords I needed to find some
articles that descriped the changes asp.net 2.0's life- cycle came with.

Unfortunately I wasn't able to change my project in that way (its too
complex after more than 2 years of development) so I decided to implement
some code that workes around that issue and all the postback- stuff.

"Lloyd Sheen" wrote:
I believe you need to create the controls in the Page_Init. Once you have
done this the page life cycle will get the values from the ViewState and you
should be good to go.

Hope this helps
Lloyd Sheen

Jan 21 '08 #3

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

Similar topics

4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
7
by: Tim T | last post by:
Hi, I have the need to use dynamically loaded user controls in a webform page. I have the controls loading dynamically, and that part works fine. this is the code used in a webform to dynamically...
0
by: John Crowley | last post by:
I'm having an odd problem with viewstate and a dynamically created control inside a repeater template. Basically, I have a repeater setup like this in the aspx:
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
1
by: Josh | last post by:
Hi Guys, I have been having a big problem with trying to pass parameters into a user control when the user control is dynamically loaded into a placholder. I am developing in c#. I have get...
2
by: mawi | last post by:
Hi there, When removing page children controls created dynamically not in last-to-first order, the close button of the last control looses its event wiring, even though the handler is rewired...
4
by: Harry | last post by:
Hello, I have a page with a RadioButtonList and a PlaceHolder control. The RadioButtonList's AutoPostBack attribute is set to TRUE and its SelectedIndexChanged event loads one of three...
0
by: Matt Howeson | last post by:
I have a problem with a usercontrol that is dynamically loaded, from a web control and is not restoring it's viewstate properly. Here's the scenario. Within our content management system, I have...
7
by: Nathan Sokalski | last post by:
I have a page which I dynamically add several usercontrols (*.ascx files) to using the following code: Public Sub Refresh() For Each section As DataRow In Me.GetSections().Rows...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.