Hello Douglas,
Looking at the nature of this issue, I would highly recommend you contact
Microsoft Product Support Services since it would require intensive
troubleshooting which would be done quickly and effectively with direct
assistance from a Microsoft Support Professional.
Microsoft support home page:
http://support.microsoft.com.
To view support options:
http://support.microsoft.com/default...d=sz;en-us;top.
To submit an online request:
http://support.microsoft.com/default...incidentsubmit.
Thanks very much.
Best regards,
Yanhong Huang
Microsoft Online Partner Support
Get Secure! ¨C
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
!From: "Douglas J. Badin" <>
!Subject: .ascx UserControl Properties are set after Page_Load only on
PostBacks
!Date: Mon, 13 Oct 2003 12:31:25 -0400
!Lines: 79
!X-Priority: 3
!X-MSMail-Priority: Normal
!X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
!X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
!Message-ID: <#>
!Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
!NNTP-Posting-Host: fll-vodsl60-cust180.mpowercom.net 208.57.60.180
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
!Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet.buildingc ontrols:7746
!X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
!
!I wanted to have a hierarchical DataGrid so I created a User Control that
!has a DataGrid to act as the Child Grid. I put it inside a pageable Parent
!Grid with a page size of one as below in Parent.aspx.
!
!<%@ Register Tagprefix="ABC" Tagname="ChildDataGrid" Src="ucChild.ascx" %>
!
!<ASP

ATAGRID
! id="dgParent"
! runat="server"
! showfooter="true"
! allowpaging="true"
! pagesize="1"
! OnPageIndexChanged="dgParent_PageIndexChanged"
! datakeyfield="PK"
! datamember="Parent"
! datasource="<%# DataSet1 %>"
!>
! <COLUMNS>
! <ASP:TEMPLATECOLUMN runat="server" headertext="">
! <ITEMTEMPLATE>
!
!...
!
! <ABC:ChildDataGrid
! id="ucChild1"
! runat="server"
! FK='<%# Convert.ToInt32(DataBinder.Eval(Container, "DataItem.PK")) %>'
! />
!
!...
!
! </ITEMTEMPLATE>
! </ASP:TEMPLATECOLUMN>
! </COLUMNS>
!</ASP

ATAGRID>
!
!I have properties, "FK" for the User Control (ucChild.ascx) that hold the
!values of the relationship between the Parent and Child Grid. These are
!assigned in the Parent.aspx
!
!Initially, I DataBind the ParentDataGrid, which sets the properties of the
!User Control and then the Page_Load in the UserControl DataBinds the Child
!as follows
!
!1 - Parent.aspx.cs: Page_Load: ParentDataGrid.DataBind()
!2 - ucChild.ascx.cs: Properties are set because values are assigned to the
!"ucChild1" attributes in the Parent.aspx
!3 - ucChild.ascx.cs: Page_Load: ChildDataGrid.DataBind()
!
!No problems so far.
!
!Paging in the Parent Control causes a Page_Load with PostBack to the Parent
!Page and User Control. It then fires the PageIndexChanged event which sets
!the CurrentPageIndex and re-binds the Parent. This causes another
Page_Load
!in the User Control which is also viewed as a Post Back and then the
!properties of the User Control are set.
!
!1 - Parent.aspx.cs: Page_Load with PostBack
!2 - ucChild.ascx.cs; Page_Load with PostBack
!3 - Parent.aspx.cs: dgParent_PageIndexChanged: Set CurrentPageIndex
!4 - ucChild.ascx.cs: Page_Load with PostBack: ChildDataGrid.DataBind()
!5 - ucChild.ascx.cs: Properties are set because values are assigned to the
!"ucChild1" attributes in the Parent.aspx
!
!PROBLEM: In the Life-Cycle, the properties were set after the Page_Load on
a
!PostBack.
!
!For now I have put the ucChild.ascx.cs PostBack code in the PreRender and
!things seem to be working.
!
!QUESTION 1: Maybe I should add a RaisePostBackEvent and do it there?
!
!QUESTION 2: Why the difference of when the ucChild.ascx.cs properties are
!set depending on PostBack or not?
!
!Thanks,
!Doug
!
!
!