This is a migrated thread and some comments may be shown as answers.

Radgrid EditFormSettings WebUserControl controls null

8 Answers 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Geoff Ballard
Top achievements
Rank 1
Geoff Ballard asked on 23 Aug 2011, 11:10 AM
I have a telerik:RadGrid with inline editing using a user control.  The problem is that the user control when examined from inside the OnEditCommand event is always null; although a trace of the asp.net page shows that the controls are rendered.

My Radgrid definition:
<telerik:RadGrid runat="server" AllowPaging="True" ID="grdSPFilters" OnNeedDataSource="grdSPFilters_NeedDataSource"
                        Width="350px" OnRowDrop="grdSPFilters_RowDrop" AllowMultiRowSelection="false"
                        OnEditCommand="grdSPFilters_EditCommand" AutoGenerateColumns="false">

My Radgrid edit area definition:
<EditFormSettings UserControlName="FilterMatchRuleBuilder.ascx" EditFormType="WebUserControl">
                                <EditColumn UniqueName="FilterMatchRuleBuilder01">
                                </EditColumn>
 </EditFormSettings>

My event:
public void grdSPFilters_EditCommand(object sender, GridCommandEventArgs e)
 {
    // snip...
    GridDataItem item = (GridDataItem)e.Item;
   FilterMatchRuleBuilder frb = item.FindControl("FilterMatchRuleBuilder01") as FilterMatchRuleBuilder;

the problem is here - the item.Findcontrol never finds my user control.  I've tried enumerating through the entire item.Controls collection and no user controls exist.  Although a trace of the asp.NET page shows the user control has been rendered.  What is happening here?  All the Telerik articles I've seen demonstrate that you simply use an item.Findcontrol; however that simply does not work.

Another thing that doesn't make sense.  Inside my grdSPFilters_EditCommand method e.Item.IsInEditMode is always equal to false.

8 Answers, 1 is accepted

Sort by
0
Geoff Ballard
Top achievements
Rank 1
answered on 23 Aug 2011, 11:21 AM
I've included here some additional info. 
1) My own iteration through the control tree from within the edit event.  This does not find the user control.
2) asp.net trace of the page lifecycle, the key thing you notice here are no user control events fire, as though the control is not being properly loaded.
3) asp.net trace of the entire control tree and here you can see the usercontrols are definitely rendered "FilterMatchBuilderPrimary".

Depth 0, index 0, control GroupPanel, is control FilterMatchBuilder? False
Depth 1, index 0, control TB, is control FilterMatchBuilder? False
Depth 2, index 0, control , is control FilterMatchBuilder? False
Depth 3, index 0, control , is control FilterMatchBuilder? False
Depth 4, index 0, control , is control FilterMatchBuilder? False
Depth 5, index 0, control , is control FilterMatchBuilder? False
Depth 6, index 0, control , is control FilterMatchBuilder? False
Depth 0, index 1, control ctl00, is control FilterMatchBuilder? False
Depth 1, index 0, control , is control FilterMatchBuilder? False
Depth 2, index 0, control , is control FilterMatchBuilder? False
Depth 3, index 0, control , is control FilterMatchBuilder? False
Depth 4, index 0, control , is control FilterMatchBuilder? False
Depth 5, index 0, control , is control FilterMatchBuilder? False
Depth 6, index 0, control , is control FilterMatchBuilder? False
Depth 7, index 0, control , is control FilterMatchBuilder? False
Depth 8, index 0, control , is control FilterMatchBuilder? False
Depth 9, index 0, control , is control FilterMatchBuilder? False
Depth 9, index 1, control , is control FilterMatchBuilder? False
Depth 9, index 2, control , is control FilterMatchBuilder? False
Depth 8, index 1, control , is control FilterMatchBuilder? False
Depth 9, index 0, control , is control FilterMatchBuilder? False
Depth 10, index 0, control , is control FilterMatchBuilder? False
Depth 8, index 2, control , is control FilterMatchBuilder? False
Depth 9, index 0, control , is control FilterMatchBuilder? False
Depth 9, index 1, control , is control FilterMatchBuilder? False
Depth 9, index 2, control , is control FilterMatchBuilder? False
Depth 9, index 3, control , is control FilterMatchBuilder? False
Depth 8, index 3, control , is control FilterMatchBuilder? False
Depth 9, index 0, control ChangePageSizeLabel, is control FilterMatchBuilder? False
Depth 9, index 1, control PageSizeComboBox, is control FilterMatchBuilder? False
Depth 10, index 0, control Header, is control FilterMatchBuilder? False
Depth 10, index 1, control Footer, is control FilterMatchBuilder? False
Depth 10, index 2, control i0, is control FilterMatchBuilder? False
Depth 10, index 3, control i1, is control FilterMatchBuilder? False
Depth 10, index 4, control i2, is control FilterMatchBuilder? False
Depth 8, index 4, control , is control FilterMatchBuilder? False
Depth 9, index 0, control , is control FilterMatchBuilder? False
Depth 3, index 1, control , is control FilterMatchBuilder? False
Depth 4, index 0, control , is control FilterMatchBuilder? False
Depth 4, index 1, control , is control FilterMatchBuilder? False
Depth 4, index 2, control , is control FilterMatchBuilder? False
Depth 5, index 0, control , is control FilterMatchBuilder? False
Depth 4, index 3, control , is control FilterMatchBuilder? False
Depth 5, index 0, control , is control FilterMatchBuilder? False
Depth 4, index 4, control , is control FilterMatchBuilder? False
Depth 4, index 5, control , is control FilterMatchBuilder? False
Depth 2, index 1, control , is control FilterMatchBuilder? False
Depth 3, index 0, control , is control FilterMatchBuilder? False
Depth 4, index 0, control , is control FilterMatchBuilder? False
Depth 4, index 1, control , is control FilterMatchBuilder? False
Depth 4, index 2, control , is control FilterMatchBuilder? False
Depth 4, index 3, control , is control FilterMatchBuilder? False
Depth 4, index 4, control , is control FilterMatchBuilder? False
Depth 4, index 5, control , is control FilterMatchBuilder? False
Depth 3, index 1, control , is control FilterMatchBuilder? False
Depth 4, index 0, control , is control FilterMatchBuilder? False
Depth 5, index 0, control , is control FilterMatchBuilder? False
Depth 6, index 0, control , is control FilterMatchBuilder? False
Depth 7, index 0, control , is control FilterMatchBuilder? False
Depth 8, index 0, control , is control FilterMatchBuilder? False
Depth 9, index 0, control , is control FilterMatchBuilder? False
Depth 9, index 1, control , is control FilterMatchBuilder? False
Depth 9, index 2, control , is control FilterMatchBuilder? False
Depth 8, index 1, control , is control FilterMatchBuilder? False
Depth 9, index 0, control , is control FilterMatchBuilder? False
Depth 10, index 0, control , is control FilterMatchBuilder? False
Depth 8, index 2, control , is control FilterMatchBuilder? False
Depth 9, index 0, control , is control FilterMatchBuilder? False
Depth 9, index 1, control , is control FilterMatchBuilder? False
Depth 9, index 2, control , is control FilterMatchBuilder? False
Depth 9, index 3, control , is control FilterMatchBuilder? False
Depth 8, index 3, control , is control FilterMatchBuilder? False
Depth 9, index 0, control ChangePageSizeLabel, is control FilterMatchBuilder? False
Depth 9, index 1, control PageSizeComboBox, is control FilterMatchBuilder? False
Depth 10, index 0, control Header, is control FilterMatchBuilder? False
Depth 10, index 1, control Footer, is control FilterMatchBuilder? False
Depth 10, index 2, control i0, is control FilterMatchBuilder? False
Depth 10, index 3, control i1, is control FilterMatchBuilder? False
Depth 10, index 4, control i2, is control FilterMatchBuilder? False
Depth 8, index 4, control , is control FilterMatchBuilder? False
Depth 9, index 0, control , is control FilterMatchBuilder? False
Depth 2, index 2, control , is control FilterMatchBuilder? False
Depth 3, index 0, control , is control FilterMatchBuilder? False
Depth 4, index 0, control GECBtnExpandColumn, is control FilterMatchBuilder? False
Depth 3, index 1, control , is control FilterMatchBuilder? False
Depth 3, index 2, control , is control FilterMatchBuilder? False
Depth 4, index 0, control EditButton, is control FilterMatchBuilder? False
Depth 3, index 3, control , is control FilterMatchBuilder? False
Depth 3, index 4, control , is control FilterMatchBuilder? False
Depth 4, index 0, control , is control FilterMatchBuilder? False
Depth 3, index 5, control , is control FilterMatchBuilder? False
Depth 4, index 0, control , is control FilterMatchBuilder? False
Depth 2, index 3, control , is control FilterMatchBuilder? False
Depth 3, index 0, control , is control FilterMatchBuilder? False
Depth 3, index 1, control , is control FilterMatchBuilder? False
Depth 1, index 1, control , is control FilterMatchBuilder? False

Request Details

Session Id: fq1icie11flhmfkynjmxdgmr Request Type: POST
Time of Request: 23/08/2011 11:13:36 Status Code: 200
Request Encoding: Unicode (UTF-8) Response Encoding: Unicode (UTF-8)

Trace Information

Category Message From First(s) From Last(s)
aspx.page Begin PreInit
aspx.page End PreInit 8.52640154009412E-05 0.000085
aspx.page Begin Init 0.000136627880100303 0.000051
aspx.page End Init 0.00191433123734523 0.001778
aspx.page Begin InitComplete 0.00204428181503461 0.000130
aspx.page End InitComplete 0.00209975478890993 0.000055
aspx.page Begin LoadState 0.00214341407390438 0.000044
aspx.page End LoadState 0.00870617506654189 0.006563
aspx.page Begin ProcessPostData 0.00880838915729362 0.000102
aspx.page End ProcessPostData 0.00891625327316228 0.000108
aspx.page Begin PreLoad 0.00895991255815674 0.000044
aspx.page End PreLoad 0.00902976741414787 0.000070
aspx.page Begin Load 0.00907291306049533 0.000043
aspx.page End Load 0.00929120948546762 0.000218
aspx.page Begin ProcessPostData Second Try 0.00934000515693202 0.000049
aspx.page End ProcessPostData Second Try 0.00938777355110242 0.000048
aspx.page Begin Raise ChangedEvents 0.00942937828150891 0.000042
aspx.page End Raise ChangedEvents 0.00947509212109134 0.000046
aspx.page Begin Raise PostBackEvent 0.0095187514060858 0.000044
aspx.page End Raise PostBackEvent 2.95108208253762 2.941563
aspx.page Begin LoadComplete 2.95117556477137 0.000093
aspx.page End LoadComplete 2.95121973769502 0.000044
aspx.page Begin PreRender 2.95125980150948 0.000040
aspx.page End PreRender 2.95180066300477 0.000541
aspx.page Begin PreRenderComplete 2.9518622996424 0.000062
aspx.page End PreRenderComplete 2.95239853838987 0.000536
aspx.page Begin SaveState 2.9803009306105 0.027902
aspx.page End SaveState 2.98243972193658 0.002139
aspx.page Begin SaveStateComplete 2.9824957085491 0.000056
aspx.page End SaveStateComplete 2.9825383405568 0.000043
aspx.page Begin Render 2.98257840437127 0.000040
aspx.page End Render 2.99626379248177 0.013685

Control Tree

Control UniqueID Type Render Size Bytes (including children) ViewState Size Bytes (excluding children) ControlState Size Bytes (excluding children)
ASP.allradgrids_aspx 36293 532 0
System.Web.UI.LiteralControl 170 0 0
System.Web.UI.HtmlControls.HtmlHead 595 0 0
System.Web.UI.HtmlControls.HtmlTitle 19 0 0
System.Web.UI.HtmlControls.HtmlLink 271 0 0
System.Web.UI.HtmlControls.HtmlLink 292 0 0
System.Web.UI.LiteralControl 14 0 0
System.Web.UI.HtmlControls.HtmlForm 35494 0 0
System.Web.UI.LiteralControl 6 0 0
System.Web.UI.ScriptManager 157 0 0
System.Web.UI.LiteralControl 103 0 0
Telerik.Web.UI.RadGrid 843 1160 0
Telerik.Web.UI.GridGroupPanel 0 12 0
System.Web.UI.WebControls.Table 0 0 0
Telerik.Web.UI.GridTableRow 0 0 0
Telerik.Web.UI.GridTableCell 0 0 0
System.Web.UI.WebControls.Table 0 0 0
Telerik.Web.UI.GridTableRow 0 0 0
Telerik.Web.UI.GridTableCell 0 0 0
Telerik.Web.UI.GridTableView 0 988 0
Telerik.Web.UI.GridTable 0 0 0
Telerik.Web.UI.GridTHead 0 0 0
Telerik.Web.UI.GridPagerItem 0 24 0
System.Web.UI.WebControls.TableCell 0 28 0
System.Web.UI.WebControls.Table 0 0 0
System.Web.UI.WebControls.TableRow 0 0 0
System.Web.UI.WebControls.TableCell 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
Telerik.Web.UI.GridLinkButton 0 52 0
System.Web.UI.WebControls.Label 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.WebControls.Panel 0 56 0
System.Web.UI.WebControls.Label 0 0 0
Telerik.Web.UI.RadComboBox 0 784 20
Telerik.Web.UI.RadComboBoxHeaderFooterControl 0 48 0
Telerik.Web.UI.RadComboBoxHeaderFooterControl 0 48 0
Telerik.Web.UI.RadComboBoxItem 0 112 0
Telerik.Web.UI.RadComboBoxItem 0 112 0
Telerik.Web.UI.RadComboBoxItem 0 112 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.LiteralControl 0 0 0
Telerik.Web.UI.GridHeaderItem 0 0 0
Telerik.Web.UI.GridTableHeaderCell 0 40 0
Telerik.Web.UI.GridTableHeaderCell 0 40 0
Telerik.Web.UI.GridTableHeaderCell 0 24 0
System.Web.UI.LiteralControl 0 0 0
Telerik.Web.UI.GridTFoot 0 24 0
Telerik.Web.UI.GridFooterItem 0 0 0
Telerik.Web.UI.GridTableCell 0 28 0
Telerik.Web.UI.GridTableCell 0 28 0
Telerik.Web.UI.GridTableCell 0 28 0
Telerik.Web.UI.GridPagerItem 0 24 0
System.Web.UI.WebControls.TableCell 0 28 0
System.Web.UI.WebControls.Table 0 0 0
System.Web.UI.WebControls.TableRow 0 0 0
System.Web.UI.WebControls.TableCell 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
Telerik.Web.UI.GridLinkButton 0 52 0
System.Web.UI.WebControls.Label 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.WebControls.Panel 0 56 0
System.Web.UI.WebControls.Label 0 0 0
Telerik.Web.UI.RadComboBox 0 784 20
Telerik.Web.UI.RadComboBoxHeaderFooterControl 0 48 0
Telerik.Web.UI.RadComboBoxHeaderFooterControl 0 48 0
Telerik.Web.UI.RadComboBoxItem 0 112 0
Telerik.Web.UI.RadComboBoxItem 0 112 0
Telerik.Web.UI.RadComboBoxItem 0 112 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.LiteralControl 0 0 0
Telerik.Web.UI.GridDataItem 0 20 0
Telerik.Web.UI.GridTableCell 0 24 0
System.Web.UI.WebControls.Button 0 0 0
Telerik.Web.UI.GridTableCell 0 40 0
Telerik.Web.UI.GridTableCell 0 32 0
Telerik.Web.UI.GridEditFormItem 0 0 0
Telerik.Web.UI.GridEditFormItem+EditFormTableCell 0 24 0
Telerik.Web.UI.GridEditFormItem+EditFormTableCell 0 0 0
Telerik.Web.UI.GridDataItem 0 20 0
Telerik.Web.UI.GridTableCell 0 24 0
System.Web.UI.WebControls.Button 0 0 0
Telerik.Web.UI.GridTableCell 0 40 0
Telerik.Web.UI.GridTableCell 0 28 0
Telerik.Web.UI.GridEditFormItem 0 0 0
Telerik.Web.UI.GridEditFormItem+EditFormTableCell 0 24 0
Telerik.Web.UI.GridEditFormItem+EditFormTableCell 0 0 0
Telerik.Web.UI.GridDataItem 0 20 0
Telerik.Web.UI.GridTableCell 0 24 0
System.Web.UI.WebControls.Button 0 0 0
Telerik.Web.UI.GridTableCell 0 40 0
Telerik.Web.UI.GridTableCell 0 32 0
Telerik.Web.UI.GridEditFormItem 0 0 0
Telerik.Web.UI.GridEditFormItem+EditFormTableCell 0 24 0
Telerik.Web.UI.GridEditFormItem+EditFormTableCell 0 0 0
Telerik.Web.UI.GridDataItem 0 20 0
Telerik.Web.UI.GridTableCell 0 24 0
System.Web.UI.WebControls.Button 0 0 0
Telerik.Web.UI.GridTableCell 0 40 0
Telerik.Web.UI.GridTableCell 0 32 0
Telerik.Web.UI.GridEditFormItem 0 0 0
Telerik.Web.UI.GridEditFormItem+EditFormTableCell 0 24 0
Telerik.Web.UI.GridEditFormItem+EditFormTableCell 0 0 0
System.Web.UI.Control 0 0 0
System.Web.UI.LiteralControl 125 0 0
Telerik.Web.UI.RadGrid 8543 972 0
Telerik.Web.UI.GridGroupPanel 0 44 0
System.Web.UI.WebControls.Table 0 0 0
Telerik.Web.UI.GridTableRow 0 0 0
Telerik.Web.UI.GridTableCell 0 0 0
System.Web.UI.WebControls.Table 0 0 0
Telerik.Web.UI.GridTableRow 0 0 0
Telerik.Web.UI.GridTableCell 0 0 0
Telerik.Web.UI.GridTableView 0 556 0
Telerik.Web.UI.GridTable 0 0 0
Telerik.Web.UI.GridTHead 0 0 0
Telerik.Web.UI.GridPagerItem 0 24 0
System.Web.UI.WebControls.TableCell 0 28 0
System.Web.UI.WebControls.Table 0 0 0
System.Web.UI.WebControls.TableRow 0 0 0
System.Web.UI.WebControls.TableCell 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
Telerik.Web.UI.GridLinkButton 0 52 0
System.Web.UI.WebControls.Label 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.WebControls.Panel 0 56 0
System.Web.UI.WebControls.Label 0 0 0
Telerik.Web.UI.RadComboBox 0 760 20
Telerik.Web.UI.RadComboBoxHeaderFooterControl 0 48 0
Telerik.Web.UI.RadComboBoxHeaderFooterControl 0 48 0
Telerik.Web.UI.RadComboBoxItem 0 104 0
Telerik.Web.UI.RadComboBoxItem 0 104 0
Telerik.Web.UI.RadComboBoxItem 0 104 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.LiteralControl 0 0 0
Telerik.Web.UI.GridHeaderItem 0 0 0
Telerik.Web.UI.GridTableHeaderCell 0 40 0
Telerik.Web.UI.GridTableHeaderCell 0 40 0
Telerik.Web.UI.GridTableHeaderCell 0 28 0
System.Web.UI.LiteralControl 0 0 0
Telerik.Web.UI.GridTableHeaderCell 0 40 0
System.Web.UI.LiteralControl 0 0 0
Telerik.Web.UI.GridTableHeaderCell 0 1504 0
Telerik.Web.UI.GridTableHeaderCell 0 1508 0
Telerik.Web.UI.GridTFoot 0 24 0
Telerik.Web.UI.GridFooterItem 0 0 0
Telerik.Web.UI.GridTableCell 0 28 0
Telerik.Web.UI.GridTableCell 0 28 0
Telerik.Web.UI.GridTableCell 0 28 0
Telerik.Web.UI.GridTableCell 0 28 0
Telerik.Web.UI.GridTableCell 0 28 0
Telerik.Web.UI.GridTableCell 0 28 0
Telerik.Web.UI.GridPagerItem 0 24 0
System.Web.UI.WebControls.TableCell 0 28 0
System.Web.UI.WebControls.Table 0 0 0
System.Web.UI.WebControls.TableRow 0 0 0
System.Web.UI.WebControls.TableCell 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
Telerik.Web.UI.GridLinkButton 0 52 0
System.Web.UI.WebControls.Label 0 0 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.WebControls.Panel 0 56 0
System.Web.UI.WebControls.Label 0 0 0
Telerik.Web.UI.RadComboBox 0 760 20
Telerik.Web.UI.RadComboBoxHeaderFooterControl 0 48 0
Telerik.Web.UI.RadComboBoxHeaderFooterControl 0 48 0
Telerik.Web.UI.RadComboBoxItem 0 104 0
Telerik.Web.UI.RadComboBoxItem 0 104 0
Telerik.Web.UI.RadComboBoxItem 0 104 0
System.Web.UI.WebControls.Panel 0 0 0
System.Web.UI.LiteralControl 0 0 0
Telerik.Web.UI.GridDataItem 0 20 0
Telerik.Web.UI.GridTableCell 0 24 0
System.Web.UI.WebControls.Button 0 0 0
Telerik.Web.UI.GridTableCell 0 40 0
Telerik.Web.UI.GridTableCell 0 0 0
Telerik.Web.UI.GridLinkButton 0 0 0
Telerik.Web.UI.GridTableCell 0 28 0
Telerik.Web.UI.GridTableCell 0 20 0
System.Web.UI.DataBoundLiteralControl 0 36 0
Telerik.Web.UI.GridTableCell 0 20 0
System.Web.UI.DataBoundLiteralControl 0 20 0
Telerik.Web.UI.GridEditFormItem 0 20 0
Telerik.Web.UI.GridEditFormItem+EditFormTableCell 0 24 0
Telerik.Web.UI.GridEditFormItem+EditFormTableCell 0 0 0
System.Web.UI.WebControls.WebControl 0 0 0
ASP.filtermatchrulebuilder_ascx 0 0 0
System.Web.UI.LiteralControl 0 0 0
ASP.filtermatchbuilder_ascx 0 0 0
System.Web.UI.ResourceBasedLiteralControl 0 0 0
System.Web.UI.WebControls.DropDownList 0 32 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.DropDownList 0 32 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.DropDownList 0 32 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.TextBox 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.LiteralControl 0 0 0
ASP.filtermatchbuilder_ascx 0 0 0
System.Web.UI.ResourceBasedLiteralControl 0 0 0
System.Web.UI.WebControls.DropDownList 0 32 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.DropDownList 0 32 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.DropDownList 0 32 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.TextBox 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.WebControls.Button 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.LiteralControl 0 0 0
System.Web.UI.Control 0 0 0
System.Web.UI.ResourceBasedLiteralControl 422 0 0
System.Web.UI.WebControls.PlaceHolder 6787 0 0
System.Web.UI.LiteralControl 79 0 0
System.Web.UI.LiteralControl 71 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 74 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 70 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 88 0 0
System.Web.UI.LiteralControl 85 0 0
System.Web.UI.LiteralControl 76 0 0
System.Web.UI.LiteralControl 76 0 0
System.Web.UI.LiteralControl 72 0 0
System.Web.UI.LiteralControl 72 0 0
System.Web.UI.LiteralControl 72 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 70 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 88 0 0
System.Web.UI.LiteralControl 85 0 0
System.Web.UI.LiteralControl 76 0 0
System.Web.UI.LiteralControl 76 0 0
System.Web.UI.LiteralControl 72 0 0
System.Web.UI.LiteralControl 72 0 0
System.Web.UI.LiteralControl 72 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 87 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 79 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 69 0 0
System.Web.UI.LiteralControl 6 0 0
System.Web.UI.LiteralControl 20 0 0
0
Jayesh Goyani
Top achievements
Rank 2
answered on 23 Aug 2011, 11:39 AM
Hello,

When Edit command is fired, the edit form is not created yet. Therefore, the Null value is assigned to the UserControl. The proper place to access the edit form controls is ItemDataBound. Please examine the sample code snippet below and let me know if it works as expected:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
       {
           if (e.Item.IsInEditMode)
           {
               GridEditFormItem editFormItem = e.Item as GridEditFormItem;
               UserControl userControl= (UserControl)editFormItem.FindControl(GridEditFormItem.EditFormUserControlID);
               (userControl.FindControl("A") as HiddenField).Value = item["x"].Text;
               (userControl.FindControl("B") as HiddenField).Value = item["Y"].Text;
           }
       }


UserControlEditForm.zip

Let me know if any concern.

Thanks,
Jayesh Goyani
0
Geoff Ballard
Top achievements
Rank 1
answered on 23 Aug 2011, 02:27 PM
Hi,

Thanks, that worked.  I have 1 further problem.

The user control exposes an event that I need to attach a delegate to.  How do I do that though?

I can't in the aspx markup because the syntaax there uses the

<EditFormSettings UserControlName="FilterMatchRuleBuilder.ascx" EditFormType="WebUserControl">

markup.  And I can't in the c# because the user control only appears there during the edit databound event.
0
Walter
Top achievements
Rank 1
answered on 26 Feb 2013, 05:11 PM
Geoff, did you ever resolve your second issue regarding an event handler for an event coming from your user control? I have the same issue.

Thanks
0
Shinu
Top achievements
Rank 1
answered on 27 Feb 2013, 07:28 AM
Hi,

I suppose you want to attach event handler for controls in UserControl. Here is the sample code.
C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            GridEditFormItem item = (GridEditFormItem)e.Item;
            UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
            TextBox TextBox1 = (TextBox)userControl.FindControl("TextBox1");
            TextBox1.TextChanged += new EventHandler(TextBox1_TextChanged);
            
        }
    }
void TextBox1_TextChanged(object sender, EventArgs e)
{
 }

Thanks,
Shinu
0
Geoff Ballard
Top achievements
Rank 1
answered on 27 Feb 2013, 09:09 AM
We solved it in a different way by putting an instance of the user control the page and marking it visible in the call to OnEditCommand.
0
Walter
Top achievements
Rank 1
answered on 27 Feb 2013, 01:56 PM
Actually I just want to have an event listener for an event raised by the control itself, not one of its child controls. The reason for this is that I have not been able to get the edit form (the user control) to close when the Save or Cancel buttons in the user control are clicked. I was thinking to have the page with the RadGrid listen for the event from the user control and then try closing it in code.

Geoff, if you put an instance of the user control on the page, how do you control where it appears? Normally (by specifying the user control in EditFormSettings) the RadGrid will open it in a region below the row being edited.
0
Geoff Ballard
Top achievements
Rank 1
answered on 27 Feb 2013, 03:33 PM
It just appears at the bottom of the grid.  Not ideal but good enough as the grid does not have many entries.
Tags
Grid
Asked by
Geoff Ballard
Top achievements
Rank 1
Answers by
Geoff Ballard
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Walter
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Share this question
or