Hi.
I’m working on a legacy system trying to edit an old feature.
I need to access the selected rows from a Radgrid on post back.
I’m using Telerik.Web.UI v4.0.30319
My Grid looks like this:
<telerik:RadGrid runat="server" ID="RadGridResourcesToChange" AllowPaging="True" PageSize="50" AllowSorting="False" Visible="False" AllowMultiRowSelection="True" OnNeedDataSource="RadGridResourcesToChange_NeedDataSource"> <MasterTableView Width="100%" DataKeyNames="Resources"> <Columns> <Telerik:GridClientSelectColumn UniqueName="ResourceId" /> </Columns> </MasterTableView> <ClientSettings> <Selecting AllowRowSelect="True"></Selecting> <ClientEvents OnRowSelecting="RowSelecting" /> </ClientSettings> </telerik:RadGrid>
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PanelAfterSearch.Visible = false; } else { RadGridResourcesToChange.Visible = true; } } protected void Page_Init(object sender, EventArgs e) { if (!IsPostBack) { } else { SelectedIds = GetSelectedWorkdayIds().ToList(); } } public IEnumerable<Guid> GetSelectedWorkdayIds() { List<Guid> ids = new List<Guid>(); //Here is where I'm trying to access the selected rows. return ids; }The user enters search criteria and then on post back
I set the grid Visible=true,
triggering the needDataSource, binding the result to the grid.
And then my problem occurs, the user can then select rows, and click a button.
I would then like to access the selected rows, performing my calculation.
I have tried using:
RadGridResourcesToChange.SelectedItems
RadGridResourcesToChange.MasterTableView.Items
Everything ends up empty on post back.
/ Martin
