
Hello I got this problem yesterday at work, and i worked few extra hours to solve it and I couldn't, please read the following scenario.
1-a radgrid with multiselection rows set to "false", a button to modify and another to add data to the grid, all(2 buttons and the radgrid) exist in the same UpdatePanel(the classical one),
2-the user will select a row,press the modify button, a rad window will open(using radwindow and radwindowmanager
(note: i tried to place the rad windowmanager is outside and inside the update panel , and i also tried to remove the whole updatepanel)
3- radwindow property to postback the parent page after closing it is set to "true". when the user saves his changes using the save button in the radWindow, the changes is saved successfully. and for more insuring; after the modification done successfully and before closing the rad grid, the parent page is forced to be refreshed using JavaScript, the same function that is used in telerik forum.
so the parent page is refreshed twice , one after the modifications is completed, and another after closing the radwindow.
the problem is after the rad window is closed, the radgrid selected index change event doesn't always fire when selecting a row and if it does, an out of index exception is fired because the count of the selected rows is Zero !! so the event is fired , but no row is selected inside the code.
and another question. isn't there any direct way to know the selected index immediately when multirow selection is set to "false".?
11 Answers, 1 is accepted


If I understand you correctly, you are rebinding the RadGrid in the parent page when the window is closed. If this is the case, note that the selected items are not persisted when the grid is rebound. If you are trying to access the selected item after RadGrid is rebound, this explains why it is null. Otherwise, with single row selection, RadGrid.SelectedItems[0] always gives you the single selected item.
All the best,
Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

All right. Looking forward to your ticket. Please mention this forum thread inside, so that the ticket can be routed through.
Greetings,
Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

I have got my sample back working using needDataSource event and
<script language="javascript" type="text/javascript">
function PostCloseAction() {
//__doPostBack();
$find("gvAttributes").get_masterTableView().rebind();
}
</script>
but when i tried in my project, i got the following Javascript error in this line
$find("gvAttributes").get_masterTableView().rebind();
which was " 'null' is null or not an object"
what can i do solve this? knowing that the scriptmanager is on the masterpage....?!
This is because in a master/content page scenario you need to access the client ID of your server controls with some binding expressions. Simply replace the code you posted here with:
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
language
=
"javascript"
type
=
"text/javascript"
>
function PostCloseAction() {
//__doPostBack();
$find("<%= gvAttributes.ClientID %>").get_masterTableView().rebind();
}
</
script
>
</
telerik:RadCodeBlock
>
Here is more info on RadCodeBlock. This should work for you now.
Sincerely yours,
Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

correct if i'm wrong..
i have removed all the (RADGRID.DATASOURCE AND RADGRIRD.DATABIND()) from my code, whether it was on page_load, pageindexchanged or cleargrid..... then i added the onNeedDatasource event.with Gridview.datasource =dataset, as i fill the dataset in the page_load event.....
now the radgrid doesn't bind on all events, plus the rad window is not showing.... although its code is executed....
Is the NeeddataSource event firing? Also, note that you are creating all your column dynamically on every postback, so I moved the method call to get the data and create the grid column on top in Page_Load. Did you test the example I have attached as a reply to your support ticket? Can you point out if you have made any modifications to its example. You can also send an updated example showing your progress on this.
Sincerely yours,
Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

the example that u have sent worked perfectly....but in my project, the dataset is filled on page_load. so i used to bind the grid there, and also page index event. so from what i understood from OnNeedDataSource event is that i have to remove the the gridview bingind method and gv.datasource event from page load and page index event then add GV.DATASOURCE= the dataset filled in the page load. the radwindow isnot working and i can't really understand when the bind happens. but it the onNeedDatasource does fire, but i just don't know how to use it really....the example i sent is very simple, in the project its really hard to send an example with same scenario.....
Here are a couple of help articles that I believe are related to your scenario. I hope they can shed some light on the initialization and binding requirements for RadGrid.
RadGrid Programmatic Creation
RadGrid Advanced Databinding (using NeedDataSource)
Greetings,
Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.