Hello,
in my test scenario i insert a radbutton into the group header. This stuff is done in the following methods:
When i load the page for the first time the 'click' on the 'do'-button does not fire a event. Neither in 'radButton_Click' nor in RadGrid1_ItemCommand'. After the second 'click' to the 'do'-button the event fires.
This behavior is very strange or i missed a configuration.
Here ist the markup for the grid:
Thanks in advance for the help.
Regards Uwe
in my test scenario i insert a radbutton into the group header. This stuff is done in the following methods:
protected
void
RadGrid1_OnItemDataBound(
object
sender, GridItemEventArgs e)
{
_AppendButtonToHeader(e.Item);
}
protected
void
RadGrid1_OnItemCreated(
object
sender, GridItemEventArgs e)
{
_AppendButtonToHeader(e.Item);
}
private
void
_AppendButtonToHeader(
object
item)
{
if
(item
is
GridGroupHeaderItem)
{
var gridGroupHeaderItem = item
as
GridGroupHeaderItem;
var dataCell = gridGroupHeaderItem.DataCell;
var radButton =
new
RadButton();
radButton.ButtonType = RadButtonType.StandardButton;
radButton.Text =
"do"
;
radButton.Click +=
new
EventHandler(radButton_Click);
dataCell.Controls.Add(radButton);
dataCell.Controls.Add(
new
LiteralControl(dataCell.Text));
}
}
When i load the page for the first time the 'click' on the 'do'-button does not fire a event. Neither in 'radButton_Click' nor in RadGrid1_ItemCommand'. After the second 'click' to the 'do'-button the event fires.
This behavior is very strange or i missed a configuration.
Here ist the markup for the grid:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowPaging
=
"True"
AutoGenerateColumns
=
"false"
CellSpacing
=
"0"
GridLines
=
"None"
ShowGroupPanel
=
"True"
OnNeedDataSource
=
"RadGrid1_OnNeedDataSource"
OnItemDataBound
=
"RadGrid1_OnItemDataBound"
OnItemCreated
=
"RadGrid1_OnItemCreated"
OnPreRender
=
"RadGrid1_OnPreRender"
>
<
ClientSettings
AllowDragToGroup
=
"True"
>
</
ClientSettings
>
<
MasterTableView
AutoGenerateColumns
=
"False"
GroupLoadMode
=
"Server"
GroupsDefaultExpanded
=
"False"
>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldName
=
"gl1"
HeaderText
=
"gl1"
/>
<
telerik:GridGroupByField
FieldName
=
"gl2"
HeaderText
=
"gl2"
/>
<
telerik:GridGroupByField
FieldName
=
"gl3"
HeaderText
=
"gl3"
/>
<
telerik:GridGroupByField
FieldName
=
"gl4"
HeaderText
=
"gl4"
/>
</
SelectFields
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"gl1"
SortOrder
=
"Ascending"
/>
<
telerik:GridGroupByField
FieldName
=
"gl2"
SortOrder
=
"Ascending"
/>
<
telerik:GridGroupByField
FieldName
=
"gl3"
SortOrder
=
"Ascending"
/>
<
telerik:GridGroupByField
FieldName
=
"gl4"
SortOrder
=
"Ascending"
/>
</
GroupByFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
<
Columns
>
<
telerik:GridTemplateColumn
HeaderStyle-Width
=
"100px"
>
<
ItemTemplate
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
OnClick
=
"OnClick"
ButtonType
=
"LinkButton"
Text
=
"plah"
CommandName
=
""
></
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButton2"
runat
=
"server"
OnClick
=
"OnClick"
ButtonType
=
"LinkButton"
Text
=
"plah"
></
telerik:RadButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridButtonColumn
HeaderText
=
"Status"
UniqueName
=
"ImageColumn"
ButtonType
=
"ImageButton"
HeaderStyle-Width
=
"100px"
/>
<
telerik:GridBoundColumn
DataField
=
"Forecast_Id"
DataType
=
"System.String"
FilterControlAltText
=
"Filter type1 column"
HeaderText
=
"ForecastId"
UniqueName
=
"Forecast"
/>
<
telerik:GridBoundColumn
Display
=
"False"
DataField
=
"Forecast_StdInt03"
DataType
=
"System.Int32"
UniqueName
=
"Status"
/>
</
Columns
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
></
CommandItemSettings
>
<
RowIndicatorColumn
FilterControlAltText
=
"Filter RowIndicator column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
FilterControlAltText
=
"Filter ExpandColumn column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
></
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
<
FilterMenu
EnableImageSprites
=
"False"
></
FilterMenu
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Default"
></
HeaderContextMenu
>
</
telerik:RadGrid
>
Thanks in advance for the help.
Regards Uwe