Sub control event firing
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcontrolscs' list.


SRoche@uk.imshealth.com
Hi,

I have a page that has a 'search' user control on it, with a single
placeholder. Depending
on some options set in the search control, hitting the search button causes
one of a number
of datagrids to be loaded dynamically, and added to the placeholder
(Page.LoadControl).

This is fine.

However, the datagrid has sorting enabled, and hence hitting the header of a
column causes an
OnDataGridSort method to be fired. What I am finding is that upon postback,
unless this
dynamically created datagrid exists, the event will not fire. At present, I
load a default
datagrid in the ispostback=false section of the page_load method, so this
means on postback
there is no datagrid, and hence the event does not fire.

This seems to be a real basic problem but for the life of me I can't find a
solution ! Any
help much appreciated.

Steve...

Reply to this message...
 
    
Schannach, Pat
I had a similar problem with events not firing on a datagrid for which I
dynamically added columns. The grid & any columns you want posted back must
exist before PageLoad fires. Create the grid and any dynamically added
columns in a PageInit event handler and I bet things work.

-----Original Message-----
From: Click here to reveal e-mail address [mailto:Click here to reveal e-mail address]
Sent: Monday, August 12, 2002 8:59 AM
To: aspngcontrolscs
Subject: [aspngcontrolscs] Sub control event firing

Hi,

I have a page that has a 'search' user control on it, with a single
placeholder. Depending
on some options set in the search control, hitting the search button causes
one of a number
of datagrids to be loaded dynamically, and added to the placeholder
(Page.LoadControl).

This is fine.

However, the datagrid has sorting enabled, and hence hitting the header of a
column causes an
OnDataGridSort method to be fired. What I am finding is that upon postback,
unless this
dynamically created datagrid exists, the event will not fire. At present, I
load a default
datagrid in the ispostback=false section of the page_load method, so this
means on postback
there is no datagrid, and hence the event does not fire.

This seems to be a real basic problem but for the life of me I can't find a
solution ! Any
help much appreciated.

Steve...

| [aspngcontrolscs] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngcontrolscs.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
    
SRoche@uk.imshealth.com
Pat,

[Original message clipped]

No, doesn't help. Remember, I do not know which datagrid to load since
it can be one of many - hence I cannot load it in pageinit or pageload.
I do load it first time round (via page.ispostback==false), but when the
event is fired on the datagrid, I want it to be handled without having to
instantiate the datagrid.

I have a sample C# project (very small) that illustrates the problem if you
are interested.

Steve...

[Original message clipped]

Reply to this message...
 
 
System.Web.UI.Page




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com