| Protected Sub RadGridProducts_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridProducts.ItemCommand |
| ViewState("GridItem") = e.Item ' gets the selected row for detail |
| LblException.Text = "" |
| Select Case e.CommandName |
| End Select |
| End Sub |
| Protected Sub RadGridProducts_DetailTableDataBind(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles RadGridProducts.DetailTableDataBind |
| Try |
| Dim item As GridItem = CType(ViewState("GridItem"), GridItem) |
| Dim ProductId As String = RadGridProducts.MasterTableView.DataKeyValues(item.ItemIndex)("Id").ToString() |
| Dim DTable As DataTable = DataAccess.Products.GetAllProductPricesById(ProductId) |
| RadGridProducts.MasterTableView.DetailTables(0).DataSource = DTable |
| RadGridProducts.MasterTableView.DetailTables(0).DataBind() |
| Catch ex As Exception |
| End Try |
| End Sub |
protected override void OnInit(EventArgs e) { this.Controls.Clear(); this._RadLoadingPanel.ID = "_RadLoadingPanel"; this._RadLoadingPanel.Transparency = 30; this._RadLoadingPanel.Skin = "WebBlue"; this._RadLoadingPanel.BackgroundPosition = AjaxLoadingPanelBackgroundPosition.Center; this.Controls.Add(this._RadLoadingPanel); this._RadGrid1.Skin = "WebBlue"; this._RadGrid1.Width = Unit.Percentage(98); this._RadGrid1.GridLines = GridLines.None; this._RadGrid1.AutoGenerateColumns = false; this._RadGrid1.AllowSorting = true; this._RadGrid1.GridLines = GridLines.None; this._RadGrid1.PageSize = 100; this._RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; this._RadGrid1.ShowGroupPanel = true; this._RadGrid1.AllowPaging = true; this._RadGrid1.AllowSorting = true; this._RadGrid1.EnableLinqExpressions = false; this._RadGrid1.MasterTableView.NoMasterRecordsText = string.Format("There are no documents associated with this order / quote / proposal."); this._RadGrid1.MasterTableView.Width = Unit.Percentage(100); this._RadGrid1.NeedDataSource += RadGrid1_NeedDataSource; // Setup Columns GridBoundColumn boundColumn = new GridBoundColumn(); this._RadGrid1.MasterTableView.Columns.Add(boundColumn); boundColumn.DataField = this._DocList.DescriptionColumn.ColumnName; boundColumn.HeaderText = "Document Type"; boundColumn.UniqueName = "DocumentType"; boundColumn.AllowSorting = true; this._UpdatePanel.Unload += new EventHandler(UpdatePanel_Unload); this._UpdatePanel.ID = "ajaxPanel"; this._UpdatePanel.UpdateMode = UpdatePanelUpdateMode.Always; this._UpdatePanel.ContentTemplateContainer.Controls.Add(this._RadGrid1); this.Controls.Add(this._UpdatePanel); base.OnInit(e); }protected override void OnPreRender(EventArgs e) { _RadGrid1.MasterTableView.Rebind(); base.OnPreRender(e); var ajaxManager = RadAjaxManager.GetCurrent(Page); if (ajaxManager != null) ajaxManager.AjaxSettings.AddAjaxSetting(this._UpdatePanel, this._RadGrid1, this._RadLoadingPanel); }void UpdatePanel_Unload(object sender, EventArgs e) { MethodInfo methodInfo = typeof(ScriptManager).GetMethods(BindingFlags.NonPublic | BindingFlags.Instance) .Where(i => i.Name.Equals("System.Web.UI.IScriptManagerInternal.RegisterUpdatePanel")).First(); methodInfo.Invoke(ScriptManager.GetCurrent(Page), new object[] { sender as UpdatePanel }); }
hi, I have a Grid that updates through a User control and uses LINQ in the background and everything works fine until I Edit/Update few times. The problem is that the grid freezes after I update a couple of times and I get this javascript error. RadGrid.NET2.dll assembly version number is 5.1.3.0. Please help me solve it as this is very urgent. Thanks in anticipation.
Here's my code.
<
asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings><telerik:AjaxSetting AjaxControlID="rgProperties"><UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="rgProperties" /></UpdatedControls>
</telerik:AjaxSetting></AjaxSettings></telerik:RadAjaxManager>
<rad:RadGrid ID="rgProperties" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" AutoGenerateDeleteColumn="false" AutoGenerateEditColumn="False" EnableAJAX="True" GridLines="None" onneeddatasource="rgProperties_NeedDataSource" Height="700px" OnDeleteCommand="rgProperties_DeleteCommand" OnUpdateCommand="rgProperties_UpdateCommand">
<clientsettings> <scrolling allowscroll="True" usestaticheaders="True" /> </clientsettings>
<
MasterTableView DataKeyNames="Id" Width="100%">
<
RowIndicatorColumn Visible="False"><HeaderStyle Width="50px"></HeaderStyle>
</
RowIndicatorColumn><ExpandCollapseColumn Visible="true" Resizable="False">
<
HeaderStyle Width="200px"></HeaderStyle>
</
ExpandCollapseColumn>
<Columns>
<rad:GridEditCommandColumn EditText="Edit" UpdateText="Update" CancelText="Cancel" UniqueName="EditButtonColumn"></rad:GridEditCommandColumn>
<rad:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete" ConfirmText="Are you sure?" />
<rad:GridBoundColumn UniqueName="Ref#" HeaderText="RefNo" DataField="RefNo"/>
<rad:GridBoundColumn UniqueName="Name" HeaderText="Name" DataField="Name"/>
<rad:GridBoundColumn UniqueName="Description" HeaderText="Description" DataField="Description"/>
<rad:GridBoundColumn UniqueName="Price" HeaderText="Price" DataField="Price"/>
<rad:GridBoundColumn UniqueName="Available For" HeaderText="Available For" DataField="idAvailableFor"/>
<rad:GridBoundColumn UniqueName="Availability" HeaderText="Availability" DataField="idAvailability"/>
<rad:GridBoundColumn UniqueName="Status" HeaderText="Status" DataField="idStatus"/>
<rad:GridBoundColumn UniqueName="Property Type" HeaderText="Property Type" DataField="idPropertyType"/>
<rad:GridBoundColumn UniqueName="Property City" HeaderText="Property City" DataField="IdPropertyCity"/>
<rad:GridBoundColumn UniqueName="Property Area" HeaderText="Property Area" DataField="IdPropertyArea"/>
</Columns>
<EditFormSettings CaptionFormatString="Edit details for Property with Ref Number {0}" CaptionDataField="RefNo" UserControlName="EmployeeDetailsCS.ascx" EditFormType="WebUserControl">
<FormTableItemStyle Width="100%" Height="29px"></FormTableItemStyle>
<FormTableStyle GridLines="None" CellSpacing="0" CellPadding="2"></FormTableStyle>
<FormStyle Width="100%" BackColor="#eef2ea"></FormStyle>
<EditColumn ButtonType="ImageButton" />
</EditFormSettings>
<EditFormSettings UserControlName="~/UserControls/Properties/PropertyEditInsertForm.ascx" EditFormType="WebUserControl">
<EditColumn UniqueName="EditButtonColumn">
</EditColumn>
</EditFormSettings>
</
MasterTableView>
</
rad:RadGrid>