I have a grid where you select the grid item via a checkbox inside a templatecolumn, when you click on the checkbox it highlights the grid item and then i do other operations on the grid selected items.
The problem is that when you click one row via the checkbox other functionality does not work after that intial click, for example if i wanted to select another row via the checkbox it will not highlight the row and partial postback does not occur, i can resolve the issue by turning off ajax.
So basically you click any checkbox in any row and then functions do not work for instance the authorise command does not work, it is like the page invalid.
Attached grid html:
<
telerik:RadGrid
ID
=
"paymentsGrid"
runat
=
"server"
AllowSorting
=
"False"
AllowPaging
=
"False"
AllowFilteringByColumn
=
"False"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
AllowAutomaticDeletes
=
"True"
AutoGenerateColumns
=
"False"
MasterTableView-HeaderStyle-Wrap
=
"false"
MasterTableView-ItemStyle-Wrap
=
"false"
GridLines
=
"None"
ShowFooter
=
"true"
EnableLinqExpressions
=
"false"
onitemdatabound
=
"paymentsGrid_ItemDataBound"
OnItemCommand
=
"paymentsGrid_OnItemCommand"
ShowHeader
=
"true"
AllowMultiRowSelection
=
"true"
>
<
MasterTableView
CommandItemDisplay
=
"Top"
>
<
CommandItemTemplate
>
<
div
style
=
"margin:5px;padding:5px"
>
<
div
style
=
"float:right"
>
<
asp:LinkButton
ID
=
"lbAuthorise"
runat
=
"server"
CommandName
=
"Authorise"
OnClientClick
=
"javascript:if(!confirm('Are you sure you want to authorise the selected payments?')){return false;}"
>Authorise</
asp:LinkButton
>
</
div
>
</
div
>
</
CommandItemTemplate
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"PeriodFrom"
ReadOnly
=
"true"
UniqueName
=
"PeriodFrom"
HeaderText
=
"From"
DataFormatString
=
"{0:dd/MM/yyyy}"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"PeriodTo"
ReadOnly
=
"true"
UniqueName
=
"PeriodTo"
HeaderText
=
"To"
DataFormatString
=
"{0:dd/MM/yyyy}"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ContractReference"
ReadOnly
=
"true"
UniqueName
=
"ContractReference"
HeaderText
=
"CT-No"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ContractName"
ReadOnly
=
"true"
UniqueName
=
"ContractName"
HeaderText
=
"Contract"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SiteName"
ReadOnly
=
"true"
UniqueName
=
"SiteName"
HeaderText
=
"Site"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"TotalCost"
ReadOnly
=
"true"
UniqueName
=
"TotalCost"
HeaderText
=
"Cost"
Aggregate
=
"Sum"
DataFormatString
=
"{0:C2}"
FooterAggregateFormatString
=
"Total: {0:C2}"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"AuthorisedBy"
ReadOnly
=
"true"
UniqueName
=
"AuthorisedBy"
HeaderText
=
"Authorised By"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"AuthorisedWhen"
ReadOnly
=
"true"
UniqueName
=
"AuthorisedWhen"
HeaderText
=
"Authorised When"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"AuthorisedAmount"
ReadOnly
=
"true"
UniqueName
=
"AuthorisedAmount"
HeaderText
=
"Authorised Amount"
Aggregate
=
"Sum"
DataFormatString
=
"{0:C2}"
FooterAggregateFormatString
=
"Total Authorised: {0:C2}"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SiteID"
ReadOnly
=
"true"
Display
=
"false"
UniqueName
=
"SiteID"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ContractID"
ReadOnly
=
"true"
Display
=
"false"
UniqueName
=
"ContractID"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"PaymentID"
ReadOnly
=
"true"
Display
=
"false"
UniqueName
=
"PaymentID"
></
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"selectionColumn"
AllowFiltering
=
"false"
HeaderStyle-Width
=
"27px"
>
<
HeaderTemplate
>
<
asp:CheckBox
id
=
"chkPaymentGridHeader"
OnCheckedChanged
=
"paymentsGrid_HeaderCheckChanged"
AutoPostBack
=
"True"
runat
=
"server"
></
asp:CheckBox
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
asp:CheckBox
id
=
"chkPaymentGridItem"
OnCheckedChanged
=
"paymentsGrid_ItemCheckChanged"
AutoPostBack
=
"True"
runat
=
"server"
></
asp:CheckBox
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
<
ItemStyle
Wrap
=
"False"
></
ItemStyle
>
<
HeaderStyle
Wrap
=
"False"
></
HeaderStyle
>
<
FooterStyle
Wrap
=
"false"
></
FooterStyle
>
</
MasterTableView
>
</
telerik:RadGrid
>
The checkbox events:
protected
void
paymentsGrid_HeaderCheckChanged(
object
sender, EventArgs e)
{
if
((sender
as
CheckBox).Checked)
{
foreach
(GridDataItem dataItem
in
paymentsGrid.MasterTableView.Items)
{
(dataItem.FindControl(
"chkPaymentGridItem"
)
as
CheckBox).Checked =
true
;
dataItem.Selected =
true
;
}
}
else
{
foreach
(GridDataItem dataItem
in
paymentsGrid.MasterTableView.Items)
{
(dataItem.FindControl(
"chkPaymentGridItem"
)
as
CheckBox).Checked =
false
;
dataItem.Selected =
false
;
}
}
}
protected
void
paymentsGrid_ItemCheckChanged(
object
sender, EventArgs e)
{
bool
itemIsChecked = (sender
as
CheckBox).Checked;
((sender
as
CheckBox).Parent.Parent
as
GridItem).Selected = (sender
as
CheckBox).Checked;
}
iam using version q1 2010
Thanks