Hello
i am having a normal aspx which contain splitter control.inside that am using
<radspl:RadPane ID="rpTaregetWindow" runat="server" ContentUrl="DefaultTarget.aspx"Scrolling="Both">
</radspl:RadPane>.
my page is populating inside this radpane rpTaregetWindow.
my page which contain a rad grid .on clicking on edit,am popuping a new rad window for edit
update function.after performing the task .i can close the window by GetRadWindow().Close();
on click of save/cancel.my requirement is to reload the parent page(normal aspx page which is
not rad window) with reload of grid with previous update that we have made in popup
(child.this was not happening for my case.
if any one can help me, please reply as soon as possible
Thanks
Regards
Mathews Baby
I’ve found that you get the following JavaScript error when you have AutoGenerateColumns set to false and UseStaticHeaders set to true for a RadGrid:
Sys.InvalidOperationException: A control is already associated with the element.
I guess this is the result of telling the RadGrid to use static headers twice (in some form or another), but it was somewhat difficult to figure out what exactly was causing the JavaScript error (we found the answer by removing different attributes until we found the right one).
Here is the basic RadGrid definition (just for reference):
| <telerik:RadGrid runat="server" AutoGenerateColumns="False"> |
| <ClientSettings> |
| <Scrolling UseStaticHeaders="True" /> |
| </ClientSettings> |
| . |
| . |
| . |
| </telerik:RadGrid> |
| <asp:Panel ID="pnlSearch" DefaultButton="btnSearch" runat="server"> |
| <label>I'm looking for:</label> |
| <noscript> |
| <asp:TextBox ID="txtSearchTermNoScript" runat="server" CssClass="textInput" /> |
| </noscript> |
| <telerik:RadComboBox ID="txtSearchTerm" runat="server" AllowCustomText="true" |
| MarkFirstMatch="false" EnableLoadOnDemand="true" Width="280px" Height="168px" |
| onitemsrequested="txtSearchTerm_ItemsRequested" onload="txtSearchTerm_Load" |
| OnClientItemsRequested="OnClientItemsRequested" EnableEmbeddedSkins="false" Skin="Cks"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </telerik:RadComboBox> |
| <label>in…</label> |
| <asp:DropDownList ID="ddlSearchCollection" runat="server" CssClass="dropDownBox" /> |
| <asp:ImageButton ID="btnSearch" runat="server" CssClass="searchButton" OnClick="btnSearch_Click" /> |
| </asp:Panel> |
Competitions.aspx doesn't work and has the following characteristics:
Name column is a gridtemplatecolumn with a hyperlink control within, built programatically.
Name column opens up another RadGrid in a RadWindow.
Edit button opens a RadWindow for editing records.
When closing the Edit buttons RadWindow updates are made but the RadGrid doesn't rebind - errors: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.
Any help appreciated.
Code:
People.aspx
| <%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="People.aspx.cs" Inherits="HonoursBoard.Admin.People" Title="Untitled Page" %> | |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> | |
| <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> | |
| </asp:Content> | |
| <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> | |
| <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> | |
| <script type="text/javascript"> | |
| function ShowEditForm(id, rowIndex) | |
| { | |
| var grid = $find("<%= RadGrid1.ClientID %>"); | |
| var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element(); | |
| grid.get_masterTableView().selectItem(rowControl, true); | |
| window.radopen("PersonEditForm.aspx?intPersonID=" + id, "UserListDialog"); | |
| return false; | |
| } | |
| function ShowInsertForm() | |
| { | |
| window.radopen("PersonEditForm.aspx", "UserListDialog"); | |
| return false; | |
| } | |
| function refreshGrid(arg) | |
| { | |
| if(!arg) | |
| { | |
| $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind"); | |
| } | |
| else | |
| { | |
| $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate"); | |
| } | |
| } | |
| </script> | |
| </telerik:RadCodeBlock> | |
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> | |
| <AjaxSettings> | |
| <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> | |
| <UpdatedControls> | |
| <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> | |
| </UpdatedControls> | |
| </telerik:AjaxSetting> | |
| <telerik:AjaxSetting AjaxControlID="RadGrid1"> | |
| <UpdatedControls> | |
| <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> | |
| </UpdatedControls> | |
| </telerik:AjaxSetting> | |
| </AjaxSettings> | |
| </telerik:RadAjaxManager> | |
| <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"> | |
| <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" | |
| AllowPaging="True" AllowSorting="True" DataSourceID="SqlDataSource1" GridLines="None" | |
| Skin="Telerik" AllowAutomaticDeletes="true" Width="800px" OnItemCreated="RadGrid1_ItemCreated" | |
| AllowMultiRowSelection="false" AllowMultiRowEdit="false"> | |
| <PagerStyle Mode="NextPrevNumericAndAdvanced" /> | |
| <GroupingSettings CaseSensitive="false" /> | |
| <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" AutoGenerateColumns="False" | |
| DataKeyNames="intPersonID" DataSourceID="SqlDataSource1" PageSize="15"> | |
| <RowIndicatorColumn Visible="False"> | |
| </RowIndicatorColumn> | |
| <ExpandCollapseColumn Visible="False" Resizable="False"> | |
| </ExpandCollapseColumn> | |
| <Columns> | |
| <telerik:GridBoundColumn DataField="intPersonID" DataType="System.Int32" | |
| HeaderText="intPersonID" ReadOnly="True" SortExpression="intPersonID" | |
| UniqueName="intPersonID" Visible="false"> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridBoundColumn DataField="strTitle" HeaderText="Title" | |
| SortExpression="strTitle" UniqueName="strTitle" AllowFiltering="false"> | |
| <ItemStyle Width="40px" /> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridBoundColumn DataField="strFirstName" HeaderText="First Name" | |
| SortExpression="strFirstName" UniqueName="strFirstName" AutoPostBackOnFilter="true"> | |
| <ItemStyle Width="100px" /> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridBoundColumn DataField="strInitials" HeaderText="Initials" | |
| SortExpression="strInitials" UniqueName="strInitials" AllowFiltering="false"> | |
| <ItemStyle Width="40px" /> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridBoundColumn DataField="strLastName" HeaderText="Last Name" | |
| SortExpression="strLastName" UniqueName="strLastName" AutoPostBackOnFilter="true"> | |
| <ItemStyle Width="150px" /> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridHTMLEditorColumn UniqueName="strBiography" SortExpression="strBiography" | |
| HeaderText="Biography" DataField="strBiography" AllowFiltering="false"> | |
| <ItemStyle Width="350px" /> | |
| </telerik:GridHTMLEditorColumn> | |
| <telerik:GridDateTimeColumn DataField="datDateOfBirth" DataType="System.DateTime" | |
| UniqueName="datDateOfBirth" PickerType="DatePicker" HeaderText="Date of Birth" | |
| AllowFiltering="false" DataFormatString="{0:dd/MM/yyyy}"> | |
| <ItemStyle Width="80px" /> | |
| </telerik:GridDateTimeColumn> | |
| <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" AllowFiltering="false"> | |
| <ItemStyle Width="20px" /> | |
| <ItemTemplate> | |
| <asp:HyperLink ImageUrl="~/Images/Edit.gif" ID="EditLink" runat="server" Text="Edit"></asp:HyperLink> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this person?" | |
| ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" | |
| CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> | |
| <ItemStyle HorizontalAlign="Center" Width="10px" /> | |
| </telerik:GridButtonColumn> | |
| </Columns> | |
| <CommandItemTemplate> | |
| <asp:Image ID="AddRecord1" runat="server" | |
| ImageUrl="~/Skins/Default/Grid/AddRecord.gif" AlternateText="Add New Person" /> | |
| <a href="#" onclick="return ShowInsertForm();">Add New Person</a> | |
| </CommandItemTemplate> | |
| <EditFormSettings> | |
| <PopUpSettings ScrollBars="None"></PopUpSettings> | |
| </EditFormSettings> | |
| </MasterTableView> | |
| </telerik:RadGrid> | |
| <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Telerik"> | |
| <Windows> | |
| <telerik:RadWindow ID="UserListDialog" runat="server" Title="Add/Edit Person" Height="500px" | |
| Width="510px" Left="150px" ReloadOnShow="true" Modal="true" Skin="Telerik" | |
| KeepInScreenBounds="true" ShowContentDuringLoad="false" VisibleStatusbar="false" /> | |
| </Windows> | |
| </telerik:RadWindowManager> | |
| </telerik:RadAjaxPanel> | |
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" | |
| ConnectionString="<%$ ConnectionStrings:dbGolfHonoursConnectionString %>" | |
| DeleteCommand="DeleteAPerson" DeleteCommandType="StoredProcedure" | |
| SelectCommand="SelectAllPeople" SelectCommandType="StoredProcedure"> | |
| <DeleteParameters> | |
| <asp:Parameter Name="intPersonID" Type="Int32" /> | |
| </DeleteParameters> | |
| </asp:SqlDataSource> | |
| </asp:Content> | |
| using System; | |
| using System.Collections; | |
| using System.Configuration; | |
| using System.Data; | |
| using System.Linq; | |
| using Telerik.Web.UI; | |
| using System.Web; | |
| using System.Web.Security; | |
| using System.Web.UI; | |
| using System.Web.UI.WebControls; | |
| using System.Web.UI.WebControls.WebParts; | |
| using System.Web.UI.HtmlControls; | |
| using System.Xml.Linq; | |
| namespace HonoursBoard.Admin | |
| { | |
| public partial class People : System.Web.UI.Page | |
| { | |
| protected void Page_Load(object sender, EventArgs e) | |
| { | |
| } | |
| protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) | |
| { | |
| if (e.Item is GridDataItem) | |
| { | |
| HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink"); | |
| editLink.Attributes["href"] = "#"; | |
| editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["intPersonID"], e.Item.ItemIndex); | |
| } | |
| } | |
| protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) | |
| { | |
| if (e.Argument == "Rebind") | |
| { | |
| RadGrid1.MasterTableView.SortExpressions.Clear(); | |
| RadGrid1.MasterTableView.GroupByExpressions.Clear(); | |
| RadGrid1.Rebind(); | |
| } | |
| else if (e.Argument == "RebindAndNavigate") | |
| { | |
| RadGrid1.MasterTableView.SortExpressions.Clear(); | |
| RadGrid1.MasterTableView.GroupByExpressions.Clear(); | |
| RadGrid1RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1; | |
| RadGrid1.Rebind(); | |
| } | |
| } | |
| } | |
| } | |
| <%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Competitions.aspx.cs" Inherits="HonoursBoard.Admin.Competitions" Title="Untitled Page" %> | |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> | |
| <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> | |
| </asp:Content> | |
| <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> | |
| <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> | |
| <script type="text/javascript"> | |
| function ShowEditForm(id, rowIndex) | |
| { | |
| var grid = $find("<%= RadGrid1.ClientID %>"); | |
| var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element(); | |
| grid.get_masterTableView().selectItem(rowControl, true); | |
| window.radopen("CompetitionEditForm.aspx?intCompetitionID=" + id, "UserListDialog"); | |
| return false; | |
| } | |
| function ShowInsertForm() | |
| { | |
| window.radopen("CompetitionEditForm.aspx", "UserListDialog"); | |
| return false; | |
| } | |
| function ShowAssignForm(id, rowIndex) | |
| { | |
| var grid = $find("<%= RadGrid1.ClientID %>"); | |
| var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element(); | |
| grid.get_masterTableView().selectItem(rowControl, true); | |
| window.radopen("AssignCompetitions.aspx?intCompetitionID=" + id, "AssignCompetitions"); | |
| return false; | |
| } | |
| function refreshGrid(arg) { | |
| if (!arg) { | |
| $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind"); | |
| } | |
| else { | |
| $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate"); | |
| } | |
| } | |
| </script> | |
| </telerik:RadCodeBlock> | |
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> | |
| <AjaxSettings> | |
| <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> | |
| <UpdatedControls> | |
| <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> | |
| </UpdatedControls> | |
| </telerik:AjaxSetting> | |
| <telerik:AjaxSetting AjaxControlID="RadGrid1"> | |
| <UpdatedControls> | |
| <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> | |
| </UpdatedControls> | |
| </telerik:AjaxSetting> | |
| </AjaxSettings> | |
| </telerik:RadAjaxManager> | |
| <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px"> | |
| <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" | |
| AllowPaging="True" AllowSorting="True" DataSourceID="SqlDataSource1" GridLines="None" | |
| Skin="Telerik" AllowAutomaticDeletes="true" Width="480px" OnItemCreated="RadGrid1_ItemCreated" | |
| AllowMultiRowSelection="false" AllowMultiRowEdit="false"> | |
| <PagerStyle Mode="NextPrevNumericAndAdvanced" /> | |
| <GroupingSettings CaseSensitive="false" /> | |
| <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" AutoGenerateColumns="False" | |
| DataKeyNames="intCompetitionID" DataSourceID="SqlDataSource1" PageSize="15"> | |
| <RowIndicatorColumn Visible="False"> | |
| </RowIndicatorColumn> | |
| <ExpandCollapseColumn Visible="False" Resizable="False"> | |
| </ExpandCollapseColumn> | |
| <Columns> | |
| <telerik:GridBoundColumn DataField="intCompetitionID" DataType="System.Int32" | |
| HeaderText="intCompetitionID" ReadOnly="True" SortExpression="intCompetitionID" | |
| UniqueName="intCompetitionID" Visible="false"> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridTemplateColumn HeaderText="Competition" DataField="strCompetitionTitle" | |
| SortExpression="strCompetitionTitle" UniqueName="strCompetitionTitle" AllowFiltering="true" | |
| AutoPostBackOnFilter="true"> | |
| <ItemStyle Width="250px" /> | |
| <ItemTemplate> | |
| <asp:HyperLink ID="AssignLink" runat="server"></asp:HyperLink> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <telerik:GridBoundColumn DataField="intPrestigeOrder" DataType="System.Int32" | |
| HeaderText="Prestige Order" SortExpression="intPrestigeOrder" | |
| UniqueName="intPrestigeOrder" AutoPostBackOnFilter="true" AllowFiltering="false" | |
| visible="false"> | |
| <ItemStyle Width="50px" /> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridCheckBoxColumn DataField="bitMultipleWinners" DataType="System.Boolean" | |
| HeaderText="Mulitple Winners" SortExpression="bitMultipleWinners" | |
| UniqueName="bitMultipleWinners" AutoPostBackOnFilter="true" ReadOnly="false" | |
| AllowFiltering="false"> | |
| <ItemStyle Width="50px" /> | |
| </telerik:GridCheckBoxColumn> | |
| <telerik:GridCheckBoxColumn DataField="bitDisplay" DataType="System.Boolean" | |
| HeaderText="Display" SortExpression="bitDisplay" AllowFiltering="false" | |
| UniqueName="bitDisplay" AutoPostBackOnFilter="true" ReadOnly="false"> | |
| <ItemStyle Width="50px" /> | |
| </telerik:GridCheckBoxColumn> | |
| <telerik:GridCheckBoxColumn DataField="bitInternalCompetition" DataType="System.Boolean" | |
| HeaderText="Internal Competition" SortExpression="bitInternalCompetition" AllowFiltering="false" | |
| UniqueName="bitInternalCompetition" AutoPostBackOnFilter="true" ReadOnly="false"> | |
| <ItemStyle Width="50px" /> | |
| </telerik:GridCheckBoxColumn> | |
| <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" AllowFiltering="false"> | |
| <ItemStyle Width="20px" /> | |
| <ItemTemplate> | |
| <asp:HyperLink ImageUrl="~/Images/Edit.gif" ID="EditLink" runat="server" Text="Edit"></asp:HyperLink> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this competition?" | |
| ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" | |
| CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> | |
| <ItemStyle HorizontalAlign="Center" Width="10px" /> | |
| </telerik:GridButtonColumn> | |
| </Columns> | |
| <CommandItemTemplate> | |
| <asp:Image ID="AddRecord1" runat="server" | |
| ImageUrl="~/Skins/Default/Grid/AddRecord.gif" AlternateText="Add New Competition" /> | |
| <a href="#" onclick="return ShowInsertForm();">Add New Competition</a> | |
| </CommandItemTemplate> | |
| <EditFormSettings> | |
| <PopUpSettings ScrollBars="None"></PopUpSettings> | |
| </EditFormSettings> | |
| </MasterTableView> | |
| </telerik:RadGrid> | |
| <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Telerik"> | |
| <Windows> | |
| <telerik:RadWindow ID="UserListDialog" runat="server" Title="Add/Edit Competition" Height="500px" | |
| Width="510px" Left="150px" ReloadOnShow="true" Modal="true" Skin="Telerik" | |
| KeepInScreenBounds="true" ShowContentDuringLoad="false" VisibleStatusbar="false" /> | |
| <telerik:RadWindow ID="AssignCompetitions" runat="server" Title="Assign Competitions" Height="600px" | |
| Width="550px" Left="150px" ReloadOnShow="true" Modal="true" Skin="Telerik" | |
| KeepInScreenBounds="true" ShowContentDuringLoad="false" VisibleStatusbar="false" /> | |
| </Windows> | |
| </telerik:RadWindowManager> | |
| </telerik:RadAjaxPanel> | |
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" | |
| ConnectionString="<%$ ConnectionStrings:dbGolfHonoursConnectionString %>" | |
| DeleteCommand="DeleteACompetition" DeleteCommandType="StoredProcedure" | |
| SelectCommand="SelectAllCompetitions" SelectCommandType="StoredProcedure"> | |
| <DeleteParameters> | |
| <asp:Parameter Name="intCompetitionID" Type="Int32" /> | |
| </DeleteParameters> | |
| </asp:SqlDataSource> | |
| </asp:Content> | |
| using System; | |
| using System.Collections; | |
| using System.Configuration; | |
| using System.Data; | |
| using System.Linq; | |
| using Telerik.Web.UI; | |
| using Telerik.Pdf; | |
| using System.Web; | |
| using System.Web.Security; | |
| using System.Web.UI; | |
| using System.Web.UI.WebControls; | |
| using System.Web.UI.WebControls.WebParts; | |
| using System.Web.UI.HtmlControls; | |
| using System.Xml.Linq; | |
| namespace HonoursBoard.Admin | |
| { | |
| public partial class Competitions : System.Web.UI.Page | |
| { | |
| protected void Page_Load(object sender, EventArgs e) | |
| { | |
| } | |
| protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) | |
| { | |
| if (e.Item is GridDataItem) | |
| { | |
| HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink"); | |
| editLink.Attributes["href"] = "#"; | |
| editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["intCompetitionID"], e.Item.ItemIndex); | |
| HyperLink AssignLink = (HyperLink)e.Item.FindControl("AssignLink"); | |
| AssignLink.Attributes["href"] = "#"; | |
| AssignLink.Attributes["onclick"] = String.Format("return ShowAssignForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["intCompetitionID"], e.Item.ItemIndex); | |
| DataRowView dataRow = (System.Data.DataRowView)e.Item.DataItem; | |
| AssignLink.Text = dataRow["strCompetitionName"].ToString(); | |
| } | |
| } | |
| protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) | |
| { | |
| if (e.Argument == "Rebind") | |
| { | |
| RadGrid1.MasterTableView.SortExpressions.Clear(); | |
| RadGrid1.MasterTableView.GroupByExpressions.Clear(); | |
| RadGrid1.Rebind(); | |
| } | |
| else if (e.Argument == "RebindAndNavigate") | |
| { | |
| RadGrid1.MasterTableView.SortExpressions.Clear(); | |
| RadGrid1.MasterTableView.GroupByExpressions.Clear(); | |
| RadGrid1RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1; | |
| RadGrid1.Rebind(); | |
| } | |
| } | |
| } | |
| } | |
| <script type="text/javascript"> | |
| function CloseAndRebind(args) | |
| { | |
| GetRadWindow().Close(); | |
| GetRadWindow().BrowserWindow.refreshGrid(args); | |
| } | |
| function GetRadWindow() | |
| { | |
| var oWindow = null; | |
| if (window.radWindow) | |
| oWindow = window.radWindow; //Will work in Moz in all cases, including classic dialog | |
| else if (window.frameElement.radWindow) | |
| oWindow = window.frameElement.radWindow;//IE (and Moz as well) | |
| return oWindow; | |
| } | |
| function CancelEdit() | |
| { | |
| GetRadWindow().Close(); | |
| } | |
| </script> |
| using System; | |
| using System.Collections; | |
| using System.Configuration; | |
| using System.Data; | |
| using System.Linq; | |
| using Telerik.Web.UI; | |
| 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; | |
| namespace HonoursBoard.Admin | |
| { | |
| public partial class PersonEditForm : System.Web.UI.Page | |
| { | |
| protected void Page_Init(object sender, EventArgs e) | |
| { | |
| if (Request.QueryString["intPersonID"] == null) | |
| { | |
| DetailsView1.DefaultMode = DetailsViewMode.Insert; | |
| } | |
| else | |
| { | |
| DetailsView1.DefaultMode = DetailsViewMode.Edit; | |
| } | |
| } | |
| protected void DetailsView1_ItemCommand(object sender, System.Web.UI.WebControls.DetailsViewCommandEventArgs e) | |
| { | |
| if (e.CommandName == "Update") | |
| { | |
| ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true); | |
| } | |
| else if (e.CommandName == "Insert") | |
| { | |
| ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind('navigateToInserted');", true); | |
| } | |
| else | |
| { | |
| ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CancelEdit();", true); | |
| } | |
| } | |
| } | |
| } |