I have a custom 2003 web part which contains a .ascx
control. This .ascx control has a datagrid (grdData),
a button (btnDisplay) and a label (lblText). The
datagrid has sort capability and when
grdData_SortCommand is triggered, the data sorts on
that column and text is displayed in lblText. Also,
when I click btnDisplay, text is displayed in lblText.
I test the .ascx control on a web form and it works as
advertised. When I incorporate the .ascx control into
the web part, the data for the grid retrieves fine,
but grdData_SortCommand never gets triggered. What's
strange is I can click on the button within the .ascx
control and it will fire that event.
Does anyone have a clue why grdData_SortCommand never
fires within the web part.
Here's the web part source code for
CreateChildControls:
UserTDAP =
CType(Page.LoadControl("/controls/DTCControls/TDAP.ascx"),
DTCControls.TDAP)
AddHandler UserTDAP.grdData.SortCommand, AddressOf
UserTDAP.grdData_SortCommand
Controls.Add(UserTDAP)
Here's the source code for RenderWebPart:
Me.EnsureChildControls()
Dim Asr As AppSettingsReader = New AppSettingsReader
Dim strOrg As String = CStr(Asr.GetValue("TDAPOrg",
GetType(System.String)))
UserTDAP.Organization = strOrg
UserTDAP.RetrieveByOrgName()
' Render the control
UserTDAP.RenderControl(output)