or
| <!--test.aspx--> |
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <%@ Register assembly="RadTabStrip.Net2" namespace="Telerik.WebControls" tagprefix="radTS" %> |
| <%@ Register TagPrefix="uc" TagName="UserControl1" Src="UserControl1.ascx"%> |
| <!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>Untitled Page</title> |
| <script type="text/javascript"> |
| </script> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <asp:ScriptManager ID="ScriptManager" runat="server" /> |
| <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1"> |
| <asp:Image runat="server" ID="LoadingImage1" ImageUrl="~/Ajax/Img/loading7.gif" AlternateText="Loading..." /> |
| </telerik:RadAjaxLoadingPanel> |
| <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="RadTabStrip1"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" /> |
| <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="LoadingPanel1" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="RadMultiPage1"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="LoadingPanel1" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
| <script type="text/javascript"> |
| function onTabSelecting(sender, args) |
| { |
| if (args.get_tab().get_pageViewID()) |
| {args.get_tab().set_postBack(false);} |
| } |
| </script> |
| <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" OnPageViewCreated="RadMultiPage1_PageViewCreated"> |
| </telerik:RadMultiPage> |
| <telerik:RadTabStrip OnClientTabSelecting="onTabSelecting" ID="RadTabStrip1" SelectedIndex="0" runat="server" MultiPageID="RadMultiPage1" Skin="Office2007" OnTabClick="RadTabStrip1_TabClick" Orientation="HorizontalBottom"> |
| </telerik:RadTabStrip> |
| <span id="spnDebug" runat="server"> |
| </span> |
| </div> |
| </form> |
| </body> |
| </html> |
| <!--test.aspx.cs--> |
| using System; |
| using System.Collections; |
| using System.Configuration; |
| using System.Data; |
| using System.Linq; |
| using System.Web; |
| using System.Web.Security; |
| using System.Web.UI; |
| using System.Web.UI.HtmlControls; |
| using System.Web.UI.WebControls; |
| using System.Web.UI.WebControls.WebParts; |
| using System.Xml.Linq; |
| using Telerik.Web.UI; |
| public partial class Test : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, System.EventArgs e) |
| { |
| if (!Page.IsPostBack) |
| { |
| AddTab("Category 1"); |
| AddTab("Category 2"); |
| AddTab("Category 3"); |
| if(RadTabStrip1.Tabs.Count > 0){AddPageView(RadTabStrip1.Tabs[0]);} |
| } |
| } |
| private void AddTab(string tabName) |
| { |
| RadTab tab = new RadTab(); |
| tab.Text = tabName; |
| RadTabStrip1.Tabs.Add(tab); |
| } |
| protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e) |
| { |
| string userControlName = "UserControl1.ascx"; |
| test_UserControl1 userControl = (test_UserControl1) Page.LoadControl(userControlName); |
| userControl.ID = e.PageView.ID + "_userControl"; |
| userControl.Category = e.PageView.ID; |
| e.PageView.Controls.Add(userControl); |
| } |
| private void AddPageView(RadTab tab) |
| { |
| RadPageView pageView = new RadPageView(); |
| pageView.ID = tab.Text; |
| RadMultiPage1.PageViews.Add(pageView); |
| tab.PageViewID = pageView.ID; |
| } |
| protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e) |
| { |
| AddPageView(e.Tab); |
| e.Tab.PageView.Selected = true; |
| } |
| } |
| <!--User Control 1--> |
| <%@ Control Language="C#" AutoEventWireup="true" CodeFile="UserControl1.ascx.cs" Inherits="test_UserControl1" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="Horizontal" AutoGenerateEditColumn="true" Skin="WebBlue" OnUpdateCommand="RadGrid1_UpdateCommand" OnItemDataBound="RadGrid1_ItemDataBound" OnNeedDataSource="RadGrid1_NeedDataSource"> |
| <MasterTableView AutoGenerateColumns="True" EditMode="InPlace" TableLayout="Auto"> |
| <RowIndicatorColumn Visible="False"> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn Visible="False" Resizable="False"> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| </Columns> |
| <EditFormSettings> |
| <PopUpSettings ScrollBars="None"></PopUpSettings> |
| </EditFormSettings> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <span id="spnDebug" runat="server"/> |
| <!--UserControl1.ascx.cs--> |
| using System; |
| using System.Collections; |
| using System.Configuration; |
| using System.Data; |
| using System.Linq; |
| using System.Web; |
| using System.Web.Security; |
| using System.Web.UI; |
| using System.Web.UI.HtmlControls; |
| using System.Web.UI.WebControls; |
| using System.Web.UI.WebControls.WebParts; |
| using System.Xml.Linq; |
| using Telerik.Web.UI; |
| public partial class test_UserControl1 : System.Web.UI.UserControl |
| { |
| public string Category{get;set;} |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| spnDebug.InnerHtml = "UC loaded at " + DateTime.Now.ToString() + "<br/>Category is " + Category + "<br/>"; |
| } |
| protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
| { |
| ArrayList list = new ArrayList(); |
| switch (Category) |
| { |
| case "Category 1": |
| list.Add("Cat1 Thing 1"); |
| list.Add("Cat1 Thing 2"); |
| list.Add("Cat1 Thing 3"); |
| break; |
| case "Category 2": |
| list.Add("Cat2 Thing 1"); |
| list.Add("Cat2 Thing 2"); |
| list.Add("Cat2 Thing 3"); |
| break; |
| case "Category 3": |
| list.Add("Cat3 Thing 1"); |
| list.Add("Cat3 Thing 2"); |
| list.Add("Cat3 Thing 3"); |
| break; |
| default: |
| list.Add("Cat Unknown Thing 1"); |
| break; |
| } |
| RadGrid1.DataSource = list; |
| } |
| protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| spnDebug.InnerHtml += "RadGrid1_UpdateCommand Called<br/>"; |
| } |
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| spnDebug.InnerHtml += "RadGrid1_ItemDataBound Called<br/>"; |
| } |
| } |
I have a webpage that has a RadGrid on it (among other controls) and display a modal window when the user submits data. If the rows on the grid are less than 100 rows it all works fine. But if the row count is greater than 100 (or somewhere around 100, haven't got it to an exact figure) the parent webpage's control etc. all disappear and only once the modal window is closed does the parent window redisplay correctly.
Any ideas?
I am using the following javascript to display the window:
function OpenValidationWindow() { oWnd = window.radopen('../MarketDataPriceInputValidation.aspx', null); oWnd.show(); oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close); oWnd.SetSize(625, 600); //Adjust position of validation window oWnd.MoveTo(162.5, 110); //Set the callBack function to be called once the user has clicked on a button on the validation window oWnd.add_close(OnValidationWindowClose); }
<rad:RadGrid runat="server" ID="gridCPDiag"AllowPaging="True" AllowSorting="True" PageSize="15" AutoGenerateColumns="False" GridLines="None" BorderStyle="None" Skin="Outlook" AllowMultiRowEdit="true" AllowMultiRowSelection="true"OnNeedDataSource="gridCPDiag_NeedDataSource"OnDetailTableDataBind="gridCPDiag_DetailTableDataBind"OnInsertCommand="gridCPDiag_InsertCommand"OnDataBound="gridCPDiag_Databound"OnUpdateCommand="gridCPDiag_UpdateCommand"OnItemCreated="gridCPDiag_ItemCreated"OnDeleteCommand="gridCPDiag_DeleteCommand" OnItemDataBound="gridCPDiag_ItemDataBound"OnPreRender="gridCPDiag_PreRender" OnItemCommand="gridCPDiag_ItemCommand"> <MasterTableView Name="Master" DataKeyNames="cpd_id" CommandItemDisplay="Top" EditMode="InPlace" Width="100%"> <CommandItemTemplate> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="width:60%"> <div style="padding:3px 4px 3px 4px"> <table border="0" cellpadding="1" cellspacing="1"> <tr style="font: normal 11px tahoma, Verdana, Helvetica, Sans-serif;vertical-align:middle"> <td> <div class="toolbarIconDivider">|</div> </td> <td> <asp:LinkButton ID="master_btnAdd" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="InitInsert" ><img style="border:0px" alt="" src="../images/addemail.gif" /> Add</asp:LinkButton> <asp:LinkButton ID="master_lnkPerformInsert" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="PerformInsert" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton> </td> <td> <div class="toolbarIconDivider">|</div> </td> <td> <asp:LinkButton ID="master_btnEditSelected" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="EditSelected" ><img style="border:0px" alt="" src="../images/edit.gif" /> Edit</asp:LinkButton> <asp:LinkButton ID="master_btnUpdateEdited" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Update" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton> <asp:LinkButton ID="master_btnCancel" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="CancelAll" Visible="false" CausesValidation="false"><img style="border:0px" alt="" src="../images/cancel.gif" /> Cancel</asp:LinkButton> </td> <td> <div class="toolbarIconDivider">|</div> </td> <td> <asp:LinkButton ID="master_btnDelete" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this Clinical Pathway?')" ><img style="border:0px" alt="" src="../images/delete.gif" /> Delete</asp:LinkButton> </td> <td> <div class="toolbarIconDivider">|</div> </td> <td align="right"> <asp:LinkButton id="master_PrintFriendly" ForeColor="Black" runat="server" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" ><img style="border:0px" alt="" src="../images/print.gif" /> Printer Friendly Version</asp:LinkButton> </td> </tr> </table> </div> </td> </tr> </table> </CommandItemTemplate> <DetailTables> <rad:GridTableView Name="Detail2" DataKeyNames="cp_id" DataMember="visit" CommandItemDisplay="Top" EditMode="InPlace" Width="100%"> <CommandItemTemplate> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="width:60%"> <div style="padding:3px 4px 3px 4px"> <table border="0" cellpadding="1" cellspacing="1"> <tr style="font: normal 11px tahoma, Verdana, Helvetica, Sans-serif;vertical-align:middle"> <td> <div class="toolbarIconDivider">|</div> </td> <td> <asp:LinkButton ID="det2_btnAdd" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="InitInsert"><img style="border:0px" alt="" src="../images/addemail.gif" /> Add</asp:LinkButton> <asp:LinkButton ID="det2_lnkPerformInsert" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="PerformInsert" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton> </td> <td> <div class="toolbarIconDivider">|</div> </td> <td> <asp:LinkButton ID="det2_btnEditSelected" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="EditSelected" ><img style="border:0px" alt="" src="../images/edit.gif" /> Edit</asp:LinkButton> <asp:LinkButton ID="det2_btnUpdateEdited" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Update" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton> <asp:LinkButton ID="det2_btnCancel" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="CancelAll" Visible="false" CausesValidation="false"><img style="border:0px" alt="" src="../images/cancel.gif" /> Cancel</asp:LinkButton> </td> <td> <div class="toolbarIconDivider">|</div> </td> <td> <asp:LinkButton ID="det2_btnDelete" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this/these Clinical Pathway Visit Frequency?')" ><img style="border:0px" alt="" src="../images/delete.gif" /> Delete</asp:LinkButton> </td> </tr> </table> </div> </td> </tr> </table> </CommandItemTemplate> <DetailTables> <rad:GridTableView Name="Detail3" DataKeyNames="cpi_id" DataMember="instruction" CommandItemDisplay="Top" EditMode="InPlace" Width="100%"> <CommandItemTemplate> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="width:60%"> <div style="padding:3px 4px 3px 4px"> <table border="0" cellpadding="1" cellspacing="1"> <tr style="font: normal 11px tahoma, Verdana, Helvetica, Sans-serif;vertical-align:middle"> <td> <div class="toolbarIconDivider">|</div> </td> <td> <asp:LinkButton ID="det3_btnAdd" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="InitInsert" ><img style="border:0px" alt="" src="../images/addemail.gif" /> Add</asp:LinkButton> <asp:LinkButton ID="det3_lnkPerformInsert" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="PerformInsert" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton> </td> <td> <div class="toolbarIconDivider">|</div> </td> <td> <asp:LinkButton ID="det3_btnEditSelected" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="EditSelected" ><img style="border:0px" alt="" src="../images/edit.gif" /> Edit</asp:LinkButton> <asp:LinkButton ID="det3_btnUpdateEdited" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Update" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton> <asp:LinkButton ID="det3_btnCancel" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="CancelAll" Visible="false" CausesValidation="false"><img style="border:0px" alt="" src="../images/cancel.gif" /> Cancel</asp:LinkButton> </td> <td> <div class="toolbarIconDivider">|</div> </td> <td> <asp:LinkButton ID="det3_btnDelete" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this Clinical Pathway Instruction?')" ><img style="border:0px" alt="" src="../images/delete.gif" /> Delete</asp:LinkButton> </td> </tr> </table> </div> </td> </tr> </table> </CommandItemTemplate> <Columns> <rad:GridBoundColumn DataField="cpi_id" HeaderText="CPI_ID" UniqueName="CPI_ID" Visible="false"></rad:GridBoundColumn> <rad:GridBoundColumn DataField="instructions" HeaderText="instructions" UniqueName="instructions" Visible="false"></rad:GridBoundColumn> <rad:GridTemplateColumn HeaderText="Instructions" UniqueName="instructions" DataField="instructions"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "instructions")%> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="tbIns" runat="server" Text='<%# Bind( "instructions") %>' width="100%" TabIndex="1" TextMode="MultiLine" Rows="4"></asp:TextBox> <asp:RequiredFieldValidator ID="descValidator" Runat="server" Display="Dynamic" ControlToValidate="tbIns" ErrorMessage="* Required Field"> </asp:RequiredFieldValidator> </EditItemTemplate> <HeaderStyle Width="90%" /> </rad:GridTemplateColumn> <rad:GridTemplateColumn HeaderText="Sort Order" UniqueName="sortorder" DataField="sortorder"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "sortorder")%> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="tbSortOrder" runat="server" Text='<%# Bind( "sortorder") %>' width="30px" TabIndex="2"></asp:TextBox> <asp:RequiredFieldValidator ID="descValidator2" Runat="server" Display="Dynamic" ControlToValidate="tbSortOrder" ErrorMessage="* Required Field"> </asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Display="Dynamic" ControlToValidate="tbSortOrder" ErrorMessage="Please enter a valid sort order number." ValidationExpression="^\d+$"></asp:RegularExpressionValidator> </EditItemTemplate> </rad:GridTemplateColumn> </Columns> </rad:GridTableView> </DetailTables> <Columns> <rad:GridBoundColumn DataField="cp_id" HeaderText="CP_ID" UniqueName="CP_ID" Visible="false"></rad:GridBoundColumn> <rad:GridBoundColumn DataField="VisitFrequency" HeaderText="VisitFrequency" UniqueName="VisitFrequency" Visible="false"></rad:GridBoundColumn> <rad:GridClientSelectColumn UniqueName="ClientSelectColumnDetail1"></rad:GridClientSelectColumn> <rad:GridTemplateColumn HeaderText="Visit Frequency" UniqueName="VisitFrequency" DataField="VisitFrequency"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "VisitFrequency")%> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="tbVisit" runat="server" Text='<%# Bind( "VisitFrequency") %>' width="100%" TabIndex="1" ></asp:TextBox> <asp:RequiredFieldValidator ID="descValidator" Runat="server" Display="Dynamic" ControlToValidate="tbVisit" ErrorMessage="* Required Field"> </asp:RequiredFieldValidator> </EditItemTemplate> <HeaderStyle Width="80%" /> </rad:GridTemplateColumn> <rad:GridTemplateColumn HeaderText="Sort Order" UniqueName="Sortorder" DataField="Sortorder"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "Sortorder")%> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="tbVisitSortOrder" runat="server" Text='<%# Bind( "Sortorder") %>' width="30px" TabIndex="2" Visible="false"></asp:TextBox> <asp:RequiredFieldValidator ID="descValidator2" Runat="server" Display="Dynamic" ControlToValidate="tbVisitSortOrder" ErrorMessage="* Required Field" > </asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" Display="Dynamic" ControlToValidate="tbVisitSortOrder" ErrorMessage="Please enter a valid sort order number." ValidationExpression="^\d+$"></asp:RegularExpressionValidator> </EditItemTemplate> </rad:GridTemplateColumn> </Columns> </rad:GridTableView> </DetailTables> <Columns> <rad:GridBoundColumn DataField="cpd_id" HeaderText="CPD_ID" UniqueName="CPD_ID" Visible="False"></rad:GridBoundColumn> <rad:GridBoundColumn DataField="short_desc" HeaderText="short desc" UniqueName="short_desc" Visible="False"></rad:GridBoundColumn> <rad:GridTemplateColumn HeaderText="Diagnosis" UniqueName="short_desc" DataField="short_desc"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "short_desc")%> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="tbDiag" runat="server" Text='<%# Bind( "short_desc") %>' Width="95%" TabIndex="1"></asp:TextBox> <asp:RequiredFieldValidator ID="descValidator" Runat="server" Display="Dynamic" ControlToValidate="tbDiag" ErrorMessage="* Required field"> </asp:RequiredFieldValidator> </EditItemTemplate> <HeaderStyle Width="20%" /> </rad:GridTemplateColumn> <rad:GridTemplateColumn HeaderText="Description" UniqueName="long_desc" DataField="long_desc"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "long_desc")%> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="tbDesc" runat="server" Text='<%# Bind( "long_desc") %>' Width="95%" TabIndex="2"></asp:TextBox> </EditItemTemplate> <HeaderStyle Width="80%" /> </rad:GridTemplateColumn> </Columns> </MasterTableView> <ClientSettings EnablePostBackOnRowClick="false"> <Selecting AllowRowSelect="True"/> <ClientEvents /> </ClientSettings> </rad:RadGrid>protected void gridCPDiag_NeedDataSource(object source, Telerik.WebControls.GridNeedDataSourceEventArgs e){ if (!e.IsFromDetailTable) { ClinicalPathway cp = new ClinicalPathway(AgencyId, BranchId); DataTable dt = cp.GetClinicalPathwayList(); gridCPDiag.DataSource = dt.DefaultView; }}protected void gridCPDiag_PreRender(object sender, EventArgs e){ if (gridCPDiag.MasterTableView.IsItemInserted || cpd_id <= 0) return; int currentPageIndex = gridCPDiag.CurrentPageIndex; for (int i = 0; i < gridCPDiag.PageCount; i++) { foreach (GridDataItem item in gridCPDiag.Items) { if (cpd_id.Equals(Convert.ToInt32(item["cpd_id"].Text))) { item.Selected = true; currentPageIndex = -1; break; } } if (currentPageIndex.Equals(-1)) break; currentPageIndex++; if (currentPageIndex >= gridCPDiag.PageCount) currentPageIndex = 0; gridCPDiag.CurrentPageIndex = currentPageIndex; gridCPDiag.Rebind(); } }protected void gridCPDiag_DetailTableDataBind(object source, Telerik.WebControls.GridDetailTableDataBindEventArgs e){ GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem; switch (e.DetailTableView.DataMember) { case "visit": { string CPID = dataItem.GetDataKeyValue("cpd_id").ToString(); ClinicalPathway cp = new ClinicalPathway(AgencyId, BranchId); DataTable dt = cp.GetVisitFreqByDiag(Convert.ToInt32(CPID)); e.DetailTableView.DataSource = dt.DefaultView; break; } case "instruction": { string CPDID = dataItem.GetDataKeyValue("cp_id").ToString(); ClinicalPathway cp = new ClinicalPathway(AgencyId, BranchId); DataTable dt = cp.GetInstructionsByVisitFreq(Convert.ToInt32(CPDID)); e.DetailTableView.DataSource = dt.DefaultView; break; } } }protected void gridCPDiag_ItemDataBound(object sender, Telerik.WebControls.GridItemEventArgs e){ if (e.Item is GridCommandItem && e.Item.OwnerTableView.Name == "Master") { GridCommandItem diagcommandItem = (GridCommandItem)e.Item; LinkButton diagbtnAdd = (LinkButton)diagcommandItem.FindControl("master_btnAdd"); LinkButton diaglnkPerformInsert = (LinkButton)diagcommandItem.FindControl("master_lnkPerformInsert"); LinkButton diagbtnEditSelected = (LinkButton)diagcommandItem.FindControl("master_btnEditSelected"); LinkButton diagbtnUpdateEdited = (LinkButton)diagcommandItem.FindControl("master_btnUpdateEdited"); LinkButton diagbtnCancel = (LinkButton)diagcommandItem.FindControl("master_btnCancel"); LinkButton diagbtnDelete = (LinkButton)diagcommandItem.FindControl("master_btnDelete"); LinkButton diagbtnPrint = (LinkButton)diagcommandItem.FindControl("master_PrintFriendly"); string printurl = "ClinicalPathways/ClinicalPathwaysrpt.aspx"; diagbtnPrint.Attributes.Add("onclick", "javascript:window.open('" + printurl + "', '', '');"); if (IsMasterExpanded || IsDetailExpanded) { diagbtnAdd.Enabled=false; diagbtnEditSelected.Enabled=false; diagbtnDelete.Enabled = false; } if (hdnCommandName.Value == "master_initinsert" || hdnCommandName.Value == "master_editselected") { diagbtnAdd.Visible = false; diagbtnEditSelected.Visible = false; diagbtnDelete.Visible = false; diagbtnCancel.Visible = true; } if (hdnCommandName.Value == "master_initinsert") diaglnkPerformInsert.Visible = true; if (hdnCommandName.Value == "master_editselected") diagbtnUpdateEdited.Visible = true; if (hdnCommandName.Value == "master_performinsert" || hdnCommandName.Value == "master_update" || hdnCommandName.Value == "master_cancelall") { diagbtnAdd.Visible = true; diagbtnEditSelected.Visible = true; diagbtnDelete.Visible = true; diaglnkPerformInsert.Visible = false; diagbtnUpdateEdited.Visible = false; diagbtnCancel.Visible = false; } } if (e.Item is GridCommandItem && e.Item.OwnerTableView.Name == "Detail2") { GridCommandItem visitcommandItem = (GridCommandItem)e.Item; LinkButton visitbtnAdd = (LinkButton)visitcommandItem.FindControl("det2_btnAdd"); LinkButton visitlnkPerformInsert = (LinkButton)visitcommandItem.FindControl("det2_lnkPerformInsert"); LinkButton visitbtnEditSelected = (LinkButton)visitcommandItem.FindControl("det2_btnEditSelected"); LinkButton visitbtnUpdateEdited = (LinkButton)visitcommandItem.FindControl("det2_btnUpdateEdited"); LinkButton visitbtnCancel = (LinkButton)visitcommandItem.FindControl("det2_btnCancel"); LinkButton visitbtnDelete = (LinkButton)visitcommandItem.FindControl("det2_btnDelete"); if (IsDetailExpanded) { visitbtnAdd.Enabled = false; visitbtnEditSelected.Enabled = false; visitbtnDelete.Enabled = false; } if (hdnCommandName.Value == "det2_initinsert" || hdnCommandName.Value == "det2_editselected") { visitbtnAdd.Visible = false; visitbtnEditSelected.Visible = false; visitbtnDelete.Visible = false; visitbtnCancel.Visible = true; } if (hdnCommandName.Value == "det2_initinsert") visitlnkPerformInsert.Visible = true; if (hdnCommandName.Value == "det2_editselected") visitbtnUpdateEdited.Visible = true; if (hdnCommandName.Value == "det2_performinsert" || hdnCommandName.Value == "det2_update" || hdnCommandName.Value == "det2_cancelall") { visitbtnAdd.Visible = true; visitbtnEditSelected.Visible = true; visitbtnDelete.Visible = true; visitlnkPerformInsert.Visible = false; visitbtnUpdateEdited.Visible = false; visitbtnCancel.Visible = false; } } if (e.Item is GridCommandItem && e.Item.OwnerTableView.Name == "Detail3") { GridCommandItem inscommandItem = (GridCommandItem)e.Item; LinkButton insbtnAdd = (LinkButton)inscommandItem.FindControl("det3_btnAdd"); LinkButton inslnkPerformInsert = (LinkButton)inscommandItem.FindControl("det3_lnkPerformInsert"); LinkButton insbtnEditSelected = (LinkButton)inscommandItem.FindControl("det3_btnEditSelected"); LinkButton insbtnUpdateEdited = (LinkButton)inscommandItem.FindControl("det3_btnUpdateEdited"); LinkButton insbtnCancel = (LinkButton)inscommandItem.FindControl("det3_btnCancel"); LinkButton insbtnDelete = (LinkButton)inscommandItem.FindControl("det3_btnDelete"); if (hdnCommandName.Value == "det3_initinsert" || hdnCommandName.Value == "det3_editselected") { insbtnAdd.Visible = false; insbtnEditSelected.Visible = false; insbtnDelete.Visible = false; insbtnCancel.Visible = true; } if (hdnCommandName.Value == "det3_initinsert") inslnkPerformInsert.Visible = true; if (hdnCommandName.Value == "det3_editselected") insbtnUpdateEdited.Visible = true; if (hdnCommandName.Value == "det3_performinsert" || hdnCommandName.Value == "det3_update" || hdnCommandName.Value == "det3_cancelall") { insbtnAdd.Visible = true; insbtnEditSelected.Visible = true; insbtnDelete.Visible = true; inslnkPerformInsert.Visible = false; insbtnCancel.Visible = false; } } }protected void gridCPDiag_ItemCommand(object sender, GridCommandEventArgs e){ if (e.CommandName == RadGrid.ExpandCollapseCommandName) { foreach (GridItem item in e.Item.OwnerTableView.Items) { if (item.Expanded && item != e.Item) { item.Expanded = false; this.ExpandedStates.Remove(item.ItemIndexHierarchical); this.ClearExpandedChildren(item.ItemIndexHierarchical); } } if (!e.Item.Expanded) { this.ExpandedStates[e.Item.ItemIndexHierarchical] = true; } else { this.ExpandedStates.Remove(e.Item.ItemIndexHierarchical); this.ClearExpandedChildren(e.Item.ItemIndexHierarchical); } if (e.Item.OwnerTableView.Name == "Master") { GridCommandItem commandItem = (GridCommandItem)gridCPDiag.MasterTableView.GetItems(GridItemType.CommandItem)[0]; LinkButton diagbtnAdd = (LinkButton)commandItem.FindControl("master_btnAdd"); LinkButton diagbtnEditSelected = (LinkButton)commandItem.FindControl("master_btnEditSelected"); LinkButton diagbtnDelete = (LinkButton)commandItem.FindControl("master_btnDelete"); if (!e.Item.Expanded) { IsMasterExpanded = true; diagbtnAdd.Enabled = false; diagbtnEditSelected.Enabled = false; diagbtnDelete.Enabled = false; } else { IsMasterExpanded = false; diagbtnAdd.Enabled = true; diagbtnEditSelected.Enabled = true; diagbtnDelete.Enabled = true; } } if (e.Item.OwnerTableView.Name == "Detail2") { int countOfExpandedItems = 0; foreach (GridDataItem masterItem in gridCPDiag.MasterTableView.Items) { IsDetailExpanded = false; if (masterItem.Expanded) { GridCommandItem commandItem = (GridCommandItem)masterItem.ChildItem.NestedTableViews[0].GetItems(GridItemType.CommandItem)[0]; LinkButton visitbtnAdd = (LinkButton)commandItem.FindControl("det2_btnAdd"); LinkButton visitbtnEditSelected = (LinkButton)commandItem.FindControl("det2_btnEditSelected"); LinkButton visitbtnDelete = (LinkButton)commandItem.FindControl("det2_btnDelete"); countOfExpandedItems += 1; visitbtnAdd.Enabled = (e.Item.Expanded && countOfExpandedItems == 1); visitbtnEditSelected.Enabled = (e.Item.Expanded && countOfExpandedItems == 1); visitbtnDelete.Enabled = (e.Item.Expanded && countOfExpandedItems == 1); IsDetailExpanded = true; } } } } if (e.Item.OwnerTableView.Name == "Master") { if (e.Item is GridCommandItem) { if (e.CommandName == "InitInsert") hdnCommandName.Value = "master_initinsert"; if (e.CommandName == "PerformInsert") hdnCommandName.Value = "master_performinsert"; if (e.CommandName == "EditSelected") hdnCommandName.Value = "master_editselected"; if (e.CommandName == "Update") hdnCommandName.Value = "master_update"; if (e.CommandName == "CancelAll") hdnCommandName.Value = "master_cancelall"; if (e.CommandName == "Delete") hdnCommandName.Value = "master_delete"; } } if (e.Item.OwnerTableView.Name == "Detail2") { if (e.Item is GridCommandItem) { GridDataItem parentItem = e.Item.OwnerTableView.ParentItem; SelectedCPDiag = (int)(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["cpd_id"]); if (e.CommandName == "InitInsert") { hdnCommandName.Value = "det2_initinsert"; if (!e.Item.Expanded) IsMasterExpanded = true; else IsMasterExpanded = false; } if (e.CommandName == "PerformInsert") { hdnCommandName.Value = "det2_performinsert"; GridEditableItem insertedItem = e.Item.OwnerTableView.GetInsertItem(); if (insertedItem.IsInEditMode) { int cpv_id = 0; cpv_id = InsertVisitFreq(insertedItem); e.Item.OwnerTableView.Rebind(); } } if (e.CommandName == "EditSelected") { hdnCommandName.Value = "det2_editselected"; if (!e.Item.Expanded) IsMasterExpanded = true; else IsMasterExpanded = false; } if (e.CommandName == "Update") { hdnCommandName.Value = "det2_update"; GridTableView table = (GridTableView)e.Item.OwnerTableView; foreach (GridEditableItem editItem in table.GetItems(GridItemType.EditItem)) { string cpid = editItem.GetDataKeyValue("cp_id").ToString(); TextBox txtVisitFreq = (TextBox)editItem.FindControl("tbVisit"); TextBox txtVisitSortOrder = (TextBox)editItem.FindControl("tbVisitSortOrder"); UpdateVisitFreq(cpid, txtVisitFreq.Text, Convert.ToInt32(txtVisitSortOrder.Text)); editItem.Edit = false; } } if (e.CommandName == "CancelAll") { hdnCommandName.Value = "det2_cancelall"; } if (e.CommandName == "Delete") { hdnCommandName.Value = "det2_delete"; GridTableView table = (GridTableView)e.Item.OwnerTableView; foreach (GridDataItem childitem in table.Items) { if (childitem.Selected) { int cpid = Convert.ToInt32(childitem.GetDataKeyValue("cp_id")); string desc = childitem.Cells[3].Text; DeleteVisitFreq(cpid, desc); } } table.Rebind(); } } } if (e.Item.OwnerTableView.Name == "Detail3") { GridDataItem parentItem = e.Item.OwnerTableView.ParentItem; SelectedCPVisitFreq = (int)(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["cp_id"]); if (e.CommandName == "InitInsert") { hdnCommandName.Value = "det3_initinsert"; if (!e.Item.Expanded) IsDetailExpanded = true; else IsDetailExpanded = false; } if (e.CommandName == "PerformInsert") { hdnCommandName.Value = "det3_performinsert"; GridEditableItem insertedItem = e.Item.OwnerTableView.GetInsertItem(); if (insertedItem.IsInEditMode) { int cpi_id = 0; cpi_id = InsertVFIns(insertedItem); e.Canceled = true; e.Item.OwnerTableView.Rebind(); } } if (e.CommandName == "EditSelected") { hdnCommandName.Value = "det3_editselected"; if (!e.Item.Expanded) IsDetailExpanded = true; else IsDetailExpanded = false; } if (e.CommandName == "Update") { hdnCommandName.Value = "det3_update"; GridTableView table = (GridTableView)e.Item.OwnerTableView; foreach (GridEditableItem editItem in table.GetItems(GridItemType.EditItem)) { string cpiid = editItem.GetDataKeyValue("cpi_id").ToString(); TextBox txtInstr = (TextBox)editItem.FindControl("tbIns"); TextBox txtSortOrder = (TextBox)editItem.FindControl("tbSortOrder"); UpdateVFIns(cpiid, txtInstr.Text, Convert.ToInt32(txtSortOrder.Text)); editItem.Edit = false; } } if (e.CommandName == "CancelAll") { hdnCommandName.Value = "det3_cancelall"; } if (e.CommandName == "Delete") { hdnCommandName.Value = "det3_delete"; GridTableView table = (GridTableView)e.Item.OwnerTableView; foreach (GridDataItem childitem in table.Items) { if (childitem.Selected) { int cpid = Convert.ToInt32(childitem.GetDataKeyValue("cpi_id")); string desc = childitem.Cells[2].Text; DeleteVFIns(cpid, desc); } } table.Rebind(); } } }<ClientSettings> <DataBinding Location="~/MyWCFWebService.svc" SelectMethod="GetListAndCount" SortParameterType="String" FilterParameterType="String"></DataBinding></ClientSettings>