Hi,
I'm trying to select rows and handle them serverside. I would like to trigger a postback on multiple row selecting by drag. I managed to do a postback with this code :
function RowSelected(row, eventArgs) {
alert(row);
__doPostBack('<%=skupineGrid.ClientID %>');
}
It is triggered here <ClientEvents OnRowSelected="RowSelected" />.
Now I would like to do an update in the database for selected rows.
foreach (GridDataItem item in skupineGrid.SelectedItems)
{
item.Selected = true;
// bla bla
}
How can I achive this?
I'm trying to select rows and handle them serverside. I would like to trigger a postback on multiple row selecting by drag. I managed to do a postback with this code :
function RowSelected(row, eventArgs) {
alert(row);
__doPostBack('<%=skupineGrid.ClientID %>');
}
It is triggered here <ClientEvents OnRowSelected="RowSelected" />.
Now I would like to do an update in the database for selected rows.
foreach (GridDataItem item in skupineGrid.SelectedItems)
{
item.Selected = true;
// bla bla
}
How can I achive this?
4 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 27 Feb 2009, 06:16 AM
Hi,
Try accessing the selected rows in the Prerender event of the Grid.
CS:
Shinu
Try accessing the selected rows in the Prerender event of the Grid.
CS:
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
foreach (GridDataItem dataitem in RadGrid1.SelectedItems) |
{ |
} |
} |
Shinu
0

Lukrs
Top achievements
Rank 2
answered on 27 Feb 2009, 11:13 AM
Hi,
This doesn't work.
The codebehind in preRender doesn't get SelectedItems.
LP, Luka
This doesn't work.
The codebehind in preRender doesn't get SelectedItems.
LP, Luka
0

Princy
Top achievements
Rank 2
answered on 27 Feb 2009, 12:03 PM
Hi Luka,
Give a try with the following code snippet in the PreRender event and see whether it works
CS:
Thanks
Princy
Give a try with the following code snippet in the PreRender event and see whether it works
CS:
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
foreach (GridDataItem dataitem in RadGrid1.MasterTableView.Items) |
{ |
if (dataitem.Selected) |
{ |
// access the selected items here |
} |
} |
} |
Thanks
Princy
0

Lukrs
Top achievements
Rank 2
answered on 27 Feb 2009, 01:46 PM
Hi Princy,
I think we do not understand each other quite right.
The thing is:
I call this javascript function on client side <ClientEvents OnRowSelected="RowSelected" />
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function RowSelected(row, eventArgs) {
alert(row);
__doPostBack('<%=skupineGrid.ClientID %>');
}
</script>
</telerik:RadCodeBlock>
I click on a row, or select multiple rows with <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" /> property set to true.
The postback is triggered, but on preRender (protected void RadGrid1_PreRender(object sender, EventArgs e) ) there are no selected items.
Basicly my idea is to select rows clientside, and maintain selected rows after postback. I found tutorials that have a button, which postbacs and the rows stay selected. With my javascript I posted, RowSelected, this simply doesn't happen.
Any Ideas why?
thanks,
LP, Luka
I think we do not understand each other quite right.
The thing is:
I call this javascript function on client side <ClientEvents OnRowSelected="RowSelected" />
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function RowSelected(row, eventArgs) {
alert(row);
__doPostBack('<%=skupineGrid.ClientID %>');
}
</script>
</telerik:RadCodeBlock>
I click on a row, or select multiple rows with <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" /> property set to true.
The postback is triggered, but on preRender (protected void RadGrid1_PreRender(object sender, EventArgs e) ) there are no selected items.
Basicly my idea is to select rows clientside, and maintain selected rows after postback. I found tutorials that have a button, which postbacs and the rows stay selected. With my javascript I posted, RowSelected, this simply doesn't happen.
Any Ideas why?
thanks,
LP, Luka