Hi,
Master Grid :
<telerik:RadGrid Width="100%" ExportSettings-Excel-DefaultCellAlignment="Left" Height="600px" ClientSettings-Scrolling-AllowScroll="true" RenderMode="Lightweight" ID="RgHotelDomestic"> <ClientSettings Selecting-AllowRowSelect="true" EnableRowHoverStyle="false" EnablePostBackOnRowClick="false"> <ClientEvents OnRowSelected="RowSelected" /> </ClientSettings></telerik:RadGrid>
Popup Editor :
<telerik:RadWindow ID="RwEditHotelAllowance" runat="server" Width="600px" Height="600px" Modal="true" KeepInScreenBounds="true" Title="Edit Hotel Allowance"> <ContentTemplate> <telerik:RadGrid ID="RgHotelDomesticEdit" runat="server" AutoGenerateColumns="false" CellSpacing="-1" GridLines="Both" OnNeedDataSource="RgHotelDomesticEdit_NeedDataSource" OnItemDataBound="RgHotelDomesticEdit_ItemDataBound" Height="400px"> <ClientSettings> <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="2"></Scrolling> </ClientSettings> </ContentTemplate></telerik:RadWindow>
Js calling Popup :
<script> function RowSelected(sender, eventArgs) { debugger; var grid = sender; mygrid = grid; //console.log("grid ", grid); //console.log("mygrid2 ", mygrid); var MasterTable = grid.get_masterTableView(); var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()]; //console.log("row", row); var cell1 = MasterTable.getCellByColumnUniqueName(row, "CityId"); var cell2 = MasterTable.getCellByColumnUniqueName(row, "City"); document.getElementById("<%= EditCityId.ClientID %>").value = cell1.textContent; document.getElementById("<%= EditCityName.ClientID %>").value = cell2.textContent; document.getElementById("<%= EditCityName.ClientID %>").value = cell2.textContent; var oWnd = $find("<%= RwEditHotelAllowance.ClientID %>"); oWnd.show(); }</script>
Server Side :
protected void RgHotelDomesticEdit_NeedDataSource(object sender, GridNeedDataSourceEventArgs e){ try { //1. RgHotelDomesticEdit.DataSource = GetDT(HotelParameter,Convert.ToInt32(EditCityId.Value)); RgHotelDomesticEdit.DataSource = GetDT(HotelParameter); } catch (Exception ex) { throw; }}
Is there any way to trigger OnNeedDataSource not from page load, but from client event Popup Windows, because i need to pass paramaeter CityId (based on clicked Edit Item in master page).
Regard,
Ragil
