or
<telerik:RadWindowManager ID="RadWindowManagerMaster" runat="server" OnClientDragEnd="WindowMoved" PreserveClientState="true" Behaviors="Close, Move" Behavior="Close, Move"> <Windows> <telerik:RadWindow ID="BinAssignmentDialog" runat="server" Title="Bin Assignment" Height="384px" Width="530px" Left="400px" ReloadOnShow="true" OnClientDragEnd="WindowMoved" ShowContentDuringLoad="false" Modal="true" VisibleStatusbar="false" Top="80px" /> </Windows></telerik:RadWindowManager>function ShowBinAssignmentDialog(bintolotid) { var oWndMgr = $find("<%= RadWindowManagerMaster.ClientID %>"); var oWnd = oWndMgr.Open("BinAssignmentDetail.aspx?btl=" + bintolotid, "BinAssignmentDialog"); var x = readCookie('BinAssignmentDialogLeft'); var y = readCookie('BinAssignmentDialogTop'); if (x) { oWnd.moveTo(x, y); } else { oWnd.moveTo(80, 80); // move to top left } return false;}function WindowMoved(sender, args) { debugger; window.setTimeout(function () { SaveSizeAndPosition(sender, args); }, 10);}for (int i = 0; i < RadGrid1.PageSize; i++){ RadGrid1.EditIndexes.Add(i);}RadGrid1.Rebind();<telerik:RadGrid ID="RadGrid1" runat="server" ShowStatusBar="True" DataSourceID="SqlDataSource1" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" AutoGenerateDeleteColumn="false" AutoGenerateEditColumn="false" GridLines="None" ShowGroupPanel="True" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowMultiRowEdit="true"> <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Default"> </HeaderContextMenu> <MasterTableView DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="EmissionFactorGroupID" AllowMultiColumnSorting="True" PageSize="10" CommandItemDisplay="Bottom" CommandItemSettings-AddNewRecordText=" Add New Emission Factor Group" CommandItemSettings-ShowAddNewRecordButton="true" CommandItemSettings-ShowExportToExcelButton="true" EditMode="InPlace" NoDetailRecordsText="No emission factor groups to display." EditFormSettings-EditColumn-CancelText="Cancel" EditFormSettings-EditColumn-ButtonType="ImageButton"> <DetailTables> <telerik:GridTableView AllowMultiColumnSorting="true" DataKeyNames="EmissionFactorID" DataSourceID="SqlDataSource2" Width="100%" runat="server" AutoGenerateColumns="false" AllowFilteringByColumn="false" CommandItemDisplay="Bottom" CommandItemSettings-AddNewRecordText=" Add New Emission Factor" CommandItemSettings-ShowAddNewRecordButton="true" EditMode="InPlace" NoDetailRecordsText="No emission factors to display."> <ParentTableRelation> <telerik:GridRelationFields DetailKeyField="EmissionFactorGroupID" MasterKeyField="EmissionFactorGroupID" /> </ParentTableRelation> <DetailTables> <telerik:GridTableView AllowMultiColumnSorting="true" DataKeyNames="EmissionGasBreakdownID" DataSourceID="SqlDataSource3" Width="100%" runat="server" AutoGenerateColumns="false" AllowFilteringByColumn="false" CommandItemDisplay="Bottom" CommandItemSettings-AddNewRecordText=" Add New Gas" CommandItemSettings-ShowAddNewRecordButton="true" EditMode="InPlace" NoDetailRecordsText="No gases to display."> <ParentTableRelation> <telerik:GridRelationFields DetailKeyField="EmissionFactorID" MasterKeyField="EmissionFactorID" /> </ParentTableRelation> <Columns> <telerik:GridBoundColumn Visible="false" ReadOnly="true" DataField="EmissionGasBreakdownID" DataType="System.Int32" SortExpression="EmissionGasBreakdownID" UniqueName="EmissionGasBreakdownID"> </telerik:GridBoundColumn> <telerik:GridBoundColumn Visible="false" ReadOnly="true" DataField="EmissionFactorID" SortExpression="EmissionFactorID" UniqueName="EmissionFactorID" DataType="System.Int32"> </telerik:GridBoundColumn> <telerik:GridDropDownColumn DropDownControlType="RadComboBox" DataType="System.Int32" DataField="GasID" HeaderText="Gas" SortExpression="GasID" UniqueName="GasID" DataSourceID="SqlDataSource4" ListTextField="GasName" ListValueField="EmissionGasID"> </telerik:GridDropDownColumn> <telerik:GridBoundColumn DataField="Factor" DataType="System.Decimal" HeaderText="Factor" SortExpression="Factor" UniqueName="Factor" DataFormatString="{0:0.000000000000}"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="UOM" HeaderText="UOM" SortExpression="UOM" UniqueName="UOM"> </telerik:GridBoundColumn> <telerik:GridEditCommandColumn ButtonType="ImageButton" EditText="Edit..." UpdateText="Save your changes..." CancelText="Cancel your changes..." InsertText=" Add new item..." /> <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Are you sure you wish to delete this gas?" /> </Columns> </telerik:GridTableView> </DetailTables> <Columns> <telerik:GridBoundColumn Visible="false" ReadOnly="true" DataField="EmissionFactorID" DataType="System.Int32" HeaderText="EmissionFactorID" SortExpression="EmissionFactorID" UniqueName="EmissionFactorID"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Factor" DataType="System.Decimal" HeaderText="Factor" SortExpression="Factor" UniqueName="Factor" DataFormatString="{0:0.000000000000}"> </telerik:GridBoundColumn> <telerik:GridDateTimeColumn DataField="EffectiveFrom" DataType="System.DateTime" HeaderText="Effective From" SortExpression="EffectiveFrom" UniqueName="EffectiveFrom"> </telerik:GridDateTimeColumn> <telerik:GridDateTimeColumn DataField="EffectiveTo" DataType="System.DateTime" HeaderText="Effective To" SortExpression="EffectiveTo" UniqueName="EffectiveTo"> </telerik:GridDateTimeColumn> <telerik:GridBoundColumn DataField="Description" HeaderText="Description" SortExpression="Description" UniqueName="Description"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Source" HeaderText="Source" SortExpression="Source" UniqueName="Source"> </telerik:GridBoundColumn> <telerik:GridBoundColumn Visible="false" ReadOnly="true" DataField="EmissionFactorGroupID" DataType="System.Int32" HeaderText="EmissionFactorGroupID" SortExpression="EmissionFactorGroupID" UniqueName="EmissionFactorGroupID"> </telerik:GridBoundColumn> <telerik:GridNumericColumn DataField="IPCCTier" DataType="System.Byte" HeaderText="IPCC" SortExpression="IPCCTier" UniqueName="IPCCTier" HeaderStyle-Width="20px" ItemStyle-Width="20px" NumericType="Number"> </telerik:GridNumericColumn> <telerik:GridEditCommandColumn ButtonType="ImageButton" EditText="Edit..." UpdateText="Save your changes..." CancelText="Cancel your changes..." InsertText=" Add new item..." /> <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Are you sure you wish to delete this emission factor?" /> </Columns> <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings> <ExpandCollapseColumn Visible="True"> </ExpandCollapseColumn> </telerik:GridTableView> </DetailTables> <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings> <RowIndicatorColumn> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn Visible="false" ReadOnly="true" DataField="EmissionFactorGroupID" DataType="System.Int32" HeaderText="EmissionFactorGroupID" SortExpression="EmissionFactorGroupID" UniqueName="EmissionFactorGroupID"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="GroupName" HeaderText="Group Name" SortExpression="GroupName" UniqueName="GroupName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ResourceType" HeaderText="Resource Type" SortExpression="ResourceType" UniqueName="ResourceType"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ResourceName" HeaderText="Name" SortExpression="ResourceName" UniqueName="ResourceName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ResourceUOM" HeaderText="UOM" SortExpression="ResourceUOM" UniqueName="ResourceUOM"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Region" HeaderText="Region" SortExpression="Region" UniqueName="Region"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="OwnerTenantID" HeaderText="Owner Tenant ID" SortExpression="OwnerTenantID" UniqueName="OwnerTenantID" DataType="System.Int32" Visible="false"> </telerik:GridBoundColumn> <telerik:GridCheckBoxColumn DataField="Shared" DataType="System.Boolean" HeaderText="Shared" SortExpression="Shared" UniqueName="Shared"> </telerik:GridCheckBoxColumn> <telerik:GridEditCommandColumn ButtonType="ImageButton" EditText="Edit..." UpdateText="Save your changes..." CancelText="Cancel your changes..." InsertText=" Add new item..." /> <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Are you sure you wish to delete this emission factor group?" /> </Columns> </MasterTableView> <ClientSettings AllowDragToGroup="True"> </ClientSettings></telerik:RadGrid><asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:PlaceHolder ID="ph" runat="server"></asp:PlaceHolder> <asp:Button ID="btn_TestLoad" runat="server" Text="Test load" onclick="btn_TestLoad_Click" /> </ContentTemplate> </asp:UpdatePanel>private void LoadOwnControl() { Control ctrl = LoadControl(CurrentLoadedControlName); ph.Controls.Clear(); ph.Controls.Add(ctrl); } protected override void OnInit(EventArgs e) { base.OnInit(e); if (Session["CurrentLoadedControlName"] != null) LoadOwnControl(); } protected void Page_Load(object sender, EventArgs e) { } private string CurrentLoadedControlName { get { if (Session["CurrentLoadedControlName"] == null) Session["CurrentLoadedControlName"] = "~/DummyControl.ascx"; return Session["CurrentLoadedControlName"] as string; } set { Session["CurrentLoadedControlName"] = value; } } protected void btn_TestLoad_Click(object sender, EventArgs e) { CurrentLoadedControlName = "~/PageImageEditor.ascx"; LoadOwnControl(); }<telerik:RadImageEditor ID="RadImageEditor1" runat="server"></telerik:RadImageEditor><%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %><%@ Register src="PageImageEditor.ascx" tagname="PageImageEditor" tagprefix="uc1" %><%@ Register src="MainContainer.ascx" tagname="MainContainer" tagprefix="uc2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <%--<telerik:RadStyleSheetManager ID="RadStyleSheetManager2" runat="server"> <StyleSheets> <telerik:StyleSheetReference Name="Telerik.Web.UI.Skins.ImageEditor.css" Assembly="Telerik.Web.UI" /> <telerik:StyleSheetReference Name="Telerik.Web.UI.Skins.Default.ImageEditor.Default.css" Assembly="Telerik.Web.UI" /> <telerik:StyleSheetReference Name="Telerik.Web.UI.Skins.ToolBar.css" Assembly="Telerik.Web.UI" /> <telerik:StyleSheetReference Name="Telerik.Web.UI.Skins.Default.ToolBar.Default.css" Assembly="Telerik.Web.UI" /> <telerik:StyleSheetReference Name="Telerik.Web.UI.Skins.Dock.css" Assembly="Telerik.Web.UI" /> <telerik:StyleSheetReference Name="Telerik.Web.UI.Skins.Default.Dock.Default.css" Assembly="Telerik.Web.UI" /> </StyleSheets> </telerik:RadStyleSheetManager> --%></head><body> <form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> <Scripts> <%--Needed for JavaScript IntelliSense in VS2010--%> <%--For VS2008 replace RadScriptManager with ScriptManager--%> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" /> </Scripts> </telerik:RadScriptManager> <script type="text/javascript"> //Put your JavaScript code here. </script> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> </telerik:RadAjaxManager> <div> <uc2:MainContainer ID="MainContainer1" runat="server" /> </div> </form></body></html>Thank you!
function pageLoad() { // create references to list of controls from the form // bind cse notes based on filter rdCSENotes = $find('<%= rlMOView.FindControl("rdGridCSENotes").ClientID %>'); var tableViewCse = rdCSENotes.get_masterTableView();function GridCreated(sender, eventArgs) { alert("Grid with ClientID: " + sender.get_id() + " was created"); } function rdGridNotes_DataBinding(sender, args) { // bind notes based on id to determine security group // for identifying filter needs to be applied other than // mfgorder id // get form key to filter the notes through var hdnMfgKey = document.getElementById('ctl00_MainContent_hdnMfgKey'); // reference the grid by id var rdNotes_id = sender.get_id(); var arrNotesGridControls = new Array(6); arrNotesGridControls[0] = "rdGridCSENotes^14"; arrNotesGridControls[1] = "rdGridCSTNotes^15"; arrNotesGridControls[2] = "rdGridBSNotes^16"; arrNotesGridControls[3] = "rdGridQANotes^26"; arrNotesGridControls[4] = "rdGridPurchasingNotes^17"; arrNotesGridControls[5] = "rdGridLogisticsNotes^52"; arrNotesGridControls[6] = "rdGridCustomerSpecNotes^30"; // pull the group id for (var i = 0; i < arrNotesControls.length; i++) { var arrSplit = arrNotesControls[i].split("^"); if (rdNotes_id.search(arrSplit[0]) != -1) { // note identified attach the group to the end of the field name // and fire filter event var secGrp = arrSplit[1]; var filtKey = "MfgOrderID^" + secGrp + "^"; // apply filter to the grid data source include the security group id to handle in the service method rdCSE = $find('<%= rlMOView.FindControl("rdGridCSENotes").ClientID %>'); tableView = rdCSE.get_masterTableView(); tableView.filter(filtKey, hdnMfgKey.value, "EqualTo"); break; } } } <telerik:RadGrid ID="rdGridCSENotes" GridLines="None" EnableEmbeddedSkins="False" Skin="ddiWebBlue" runat="server" Height="48px" Width="875px" EnableViewState="false" AutoGenerateColumns="False" CellSpacing="0" AllowAutomaticUpdates="false" AllowAutomaticDeletes="False" AllowAutomaticInserts="false" ShowHeader="False" AllowPaging="false"> <MasterTableView ShowFooter="false" AllowNaturalSort="false" CommandItemDisplay="Top" ClientDataKeyNames="MfgOrderID" ItemStyle-CssClass="comments" NoMasterRecordsText=" <div style='font-size: 10px; font-family: 'segoe ui',arial,sans-serif;'>No CSE notes currently entered.</div>" TableLayout="Fixed" GridLines="Horizontal" ShowHeadersWhenNoRecords="False"> <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false" /> <CommandItemStyle CssClass="commViewCommand" /> <ItemStyle CssClass="comments" /> <AlternatingItemStyle CssClass="comments" /> <Columns> <telerik:GridDateTimeColumn DataField="StatusDateTime" DataType="System.DateTime" ItemStyle-Width="85px" DataFormatString="{0:MM/dd/yy hh:mm tt}"> </telerik:GridDateTimeColumn> <telerik:GridBoundColumn DataField="LogonID" DataType="System.String" HeaderText="DisplayName" UniqueName="DisplayName" ItemStyle-Width="70px"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="StatusComment" DataType="System.String" HeaderText="StatusComment" UniqueName="StatusComment" ItemStyle-Wrap="false" ItemStyle-Width="653px"> </telerik:GridBoundColumn> </Columns> </MasterTableView> <ClientSettings> <DataBinding Location="GridMasterDetailsService.svc" FilterParameterType="Linq" SelectMethod="GetNotesDataAndCount" SortParameterType="Linq"> </DataBinding> <ClientEvents OnDataBinding="rdGridNotes_DataBinding" OnGridCreated="GridCreated" OnCommand="function(){}" /> <Scrolling AllowScroll="True" UseStaticHeaders="true" SaveScrollPosition="True"> </Scrolling> </ClientSettings> <HeaderContextMenu EnableEmbeddedSkins="False" CssClass="GridContextMenu GridContextMenu_ddiWebBlue"> </HeaderContextMenu> </telerik:RadGrid>using System; using System.Linq; using System.Runtime.Serialization; using System.Web.Services; using System.ServiceModel; using System.ServiceModel.Activation; using System.ServiceModel.Web; using System.Collections.Generic; using System.Collections; using System.Reflection; namespace DataContracts { [DataContract] public class MO_POHdr { [DataMember] public int MfgAssocDocID { get; set; } [DataMember] public int? MfgOrderID { get; set; } [DataMember] public string ponumber { get; set; } [DataMember] public string vendname { get; set; } [DataMember] public string vendorid { get; set; } [DataMember] public string country { get; set; } [DataMember] public string vndclsid { get; set; } [DataMember] public DateTime? docdate { get; set; } [DataMember] public string hold { get; set; } [DataMember] public string shipmthd { get; set; } } [DataContract] public class MOCommentDisplay { [DataMember] public int MfgOrderLogID { get; set; } [DataMember] public int MfgOrderID { get; set; } [DataMember] public int? AccountID { get; set; } [DataMember] public int? CommentGroupAccessID { get; set; } [DataMember] public string LogonID { get; set; } [DataMember] public DateTime? StatusDateTime { get; set; } [DataMember] public int? PeriodKey { get; set; } [DataMember] public string StatusComment { get; set; } [DataMember] public string Code { get; set; } } [DataContract] public class PODet { [DataMember] public string ponumber { get; set; } [DataMember] public string itemnmbr { get; set; } [DataMember] public decimal? qtyorder { get; set; } [DataMember] public string itemdesc { get; set; } [DataMember] public string postatus { get; set; } [DataMember] public string shipmthd { get; set; } [DataMember] public DateTime? released_date { get; set; } [DataMember] public DateTime? prmdate { get; set; } [DataMember] public DateTime? reqdate { get; set; } } } public class MyData { public int Count { get; set; } public IList Data { get; set; } } [ServiceContract] [ServiceKnownType("GetKnownTypes")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class GridMasterDetailsService { public static IEnumerable<Type> GetKnownTypes(ICustomAttributeProvider provider) { List<Type> knownTypes = new List<System.Type>(); knownTypes.Add(typeof(DataContracts.MO_POHdr)); knownTypes.Add(typeof(DataContracts.PODet)); knownTypes.Add(typeof(DataContracts.MOCommentDisplay)); return knownTypes; } [OperationContract] public MyData GetMOPOHdrDataAndCount(int startRowIndex, int maximumRows, string sortExpression, string filterExpression) { maximumRows = 20; if (filterExpression != "") { filterExpression = filterExpression.Replace("\"", string.Empty); } GridBindingData data = RadGrid.GetBindingData("AppDataClassesDataContext", "MOAssocDocuments", startRowIndex, maximumRows, sortExpression, filterExpression); MyData result = new MyData(); result.Data = data.Data.OfType<MOAssocDocument>().Select(c => new DataContracts.MO_POHdr() { MfgAssocDocID = c.MfgAssocDocID, MfgOrderID = c.MfgOrderID, ponumber = c.POHdr.ponumber, vendname = c.POHdr.vendname, vendorid = c.POHdr.vendorid, country = c.POHdr.country, vndclsid = c.POHdr.vndclsid, docdate = c.POHdr.docdate, hold = c.POHdr.hold, shipmthd = c.POHdr.shipmthd }).ToList(); result.Count = data.Count; return result; } [OperationContract] public MyData GetPODetDataAndCount(int startRowIndex, int maximumRows, string sortExpression, string filterExpression) { // maximumRows = 50; GridBindingData data = RadGrid.GetBindingData("AppDataClassesDataContext", "PODets", startRowIndex, maximumRows, sortExpression, filterExpression); MyData result = new MyData(); result.Data = data.Data.OfType<PODet>().Select(o => new DataContracts.PODet() { ponumber = o.ponumber, itemnmbr = o.itemnmbr, qtyorder = o.qtyorder, itemdesc = o.itemdesc, postatus = o.postatus, shipmthd = o.shipmthd, released_date = o.released_date, prmdate = o.prmdate, reqdate=o.reqdate }).ToList(); result.Count = data.Count; return result; } [OperationContract] public MyData GetNotesDataAndCount(int startRowIndex, int maximumRows, string sortExpression, string filterExpression) { sortExpression = "StatusDateTime descending"; var sSecGrp = filterExpression.Split('^'); filterExpression = "CommentGroupAccessID EqualTo " + sSecGrp[1] + " And MfgOrderID = " + sSecGrp[2]; GridBindingData data = RadGrid.GetBindingData("AppDataClassesDataContext", "MOCommentDisplays", startRowIndex, maximumRows, sortExpression, filterExpression); MyData result = new MyData(); result.Data = data.Data.OfType<MOCommentDisplay>().Select(p => new DataContracts.MOCommentDisplay() { MfgOrderLogID = p.MfgOrderLogID, MfgOrderID = p.MfgOrderLogID, AccountID = p.AccountID, CommentGroupAccessID = p.CommentGroupAccessID, LogonID = p.Account.LogonID, StatusDateTime = p.StatusDateTime, PeriodKey = p.PeriodKey, StatusComment = p.StatusComment, Code = p.CLib.Code }).ToList(); result.Count = data.Count; return result; } }