
<telerik:RadGrid ID="GridCountryBand" runat="server" AutoGenerateColumns="false" Skin="Simple" CssClass="caronte-phase-grid" AllowPaging="False" AllowSorting="false" AllowFilteringByColumn="true" OnNeedDataSource="GridCountryBand_NeedDataSource" OnBatchEditCommand="GridCountryBand_BatchEditCommand" OnItemDataBound="GridCountryBand_ItemDataBound" > <GroupingSettings CaseSensitive="false" /> <ClientSettings> <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" /> <Selecting AllowRowSelect="true" /> <ClientEvents OnBatchEditOpening="batchEditOpening" /> </ClientSettings> <MasterTableView HeaderStyle-HorizontalAlign="Center" Width="100%" AutoGenerateColumns="false" DataKeyNames="ID_COUNTRY" EditMode="Batch"> <BatchEditingSettings EditType="Cell" OpenEditingEvent="MouseOver" /> <Columns> </Columns> </MasterTableView> </telerik:RadGrid>
Columns are added in Page_Load:
private void AddGridColumns()
{
int idTech = Convert.ToInt32(ddlTechnology.SelectedValue);
ITechnologyBandService service = SharePointServiceLocator.GetCurrent().GetInstance<ITechnologyBandService>();
DataSet data = service.GetBandsByTechnology(idTech);
if (data != null && data.Tables.Count > 0)
{
GridCountryBand.MasterTableView.Columns.Clear();
GridBoundColumn boundColumn = new GridBoundColumn();
GridCountryBand.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField = "DES_COUNTRY";
boundColumn.HeaderText = "Country";
boundColumn.ShowFilterIcon = false;
boundColumn.FilterControlWidth = Unit.Percentage(100);
boundColumn.AutoPostBackOnFilter = true;
boundColumn.HeaderStyle.Width = Unit.Pixel(150);
boundColumn.ItemStyle.Width = Unit.Pixel(150);
foreach (DataRow row in data.Tables[0].Rows)
{
GridCheckBoxColumn checkboxColumn = new GridCheckBoxColumn();
GridCountryBand.MasterTableView.Columns.Add(checkboxColumn);
checkboxColumn.DataField = row["ID_BAND"].ToString();
checkboxColumn.HeaderText = row["BAND_NAME"].ToString();
checkboxColumn.ShowFilterIcon = false;
checkboxColumn.AutoPostBackOnFilter = true;
checkboxColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
checkboxColumn.HeaderStyle.Width = Unit.Pixel(150);
checkboxColumn.ItemStyle.Width = Unit.Pixel(100);
}
}
I have an ASP.NET DropDownList in the ascx, outside the RadGrid. When page is loaded DropDownList value cannot be changed (if I set onchange JavaScript event it is not fired) until I try to edit cells (checkboxes).
If I remove batch editing mode, values in DropDownList can be changed with no problem.
Thanks and best regards,
Alfonso
Please note that I do not have a TemplateColumn in my grid to adding a blank ItemTemplate will not work. I read the forums until I am tired of doing it. If I refresh the grid after clearing the IE8 error popup, the record is deleted. I get the prompt, and the record gets deleted, but I simply must know how to get rid of this stupid message.
I'm guessing it's something with databinding, but I have no idea what.
Please help if possible. I appreciate the help in advance.
Jason
Datasource...
<asp:LinqDataSource ID="ldsDeviceToDeviceInfo" runat="server"
ContextTypeName="AssetManagementDataContext" EnableDelete="True"
EnableInsert="True" EnableUpdate="True" EntityTypeName=""
OrderBy="DeviceName, ConnType" TableName="Connections">
</asp:LinqDataSource>
I have this in my RadAjaxManager (among other things not related to this grid):
<telerik:AjaxSetting AjaxControlID="grdDevToDev">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="grdDevToDev" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
ASPX RadGrid declaration:
<telerik:RadGrid ID="grdDevToDev" runat="server" EnableLinqExpressions="False" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" CellSpacing="0" DataSourceID="ldsDeviceToDeviceInfo" Font-Names="Verdana" Font-Size="8px" GridLines="None" Skin="WebBlue" Width="90%" AutoGenerateColumns="False" onitemcommand="grdDevToDev_ItemCommand"> <ClientSettings AllowColumnsReorder="True" AllowKeyboardNavigation="true" ReorderColumnsOnClient="True" EnablePostBackOnRowClick="false" > <Selecting AllowRowSelect="True" /> <ClientEvents OnPopUpShowing="PopUpShowing" /> </ClientSettings> <MasterTableView DataKeyNames="Index" AllowAutomaticDeletes="true" DataSourceID="ldsDeviceToDeviceInfo" EditMode="Popup" CommandItemDisplay="Top" > <Columns> <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="Index" DataType="System.Int64" FilterControlAltText="Filter Index column" HeaderText="Index" ReadOnly="True" SortExpression="Index" UniqueName="Index" Visible="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="DeviceName" FilterControlAltText="Filter DeviceName column" HeaderText="DeviceName" SortExpression="DeviceName" UniqueName="DeviceName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ConnType" FilterControlAltText="Filter ConnType column" HeaderText="ConnType" SortExpression="ConnType" UniqueName="ModConnTypeel"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CableType" FilterControlAltText="Filter CableType column" HeaderText="CableType" SortExpression="CableType" UniqueName="CableType"> <HeaderStyle Width="150px" /> </telerik:GridBoundColumn> <telerik:GridButtonColumn ConfirmText="Delete this record?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="LinkButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> <HeaderStyle Width="50" /> <ItemStyle HorizontalAlign="Center" /> </telerik:GridButtonColumn> </Columns> <EditFormSettings InsertCaption="Assign/Modify Device to Device Connection" CaptionFormatString="Edit Record: {0}" CaptionDataField="Index" EditFormType="Template"> <PopUpSettings Modal="True" Width="500px" Height="500px" /> <FormTemplate> <table id="Table1" cellspacing="0" cellpadding="3" width="450" border="0"> <tr> <td colspan="3" style="height: 50px"> <asp:ValidationSummary ID="valSummaryNewDevice" ValidationGroup="SaveNewDevice" runat="server" ForeColor="DarkRed" Width="670px" /> </td> </tr> <tr> <td colspan="3"> <br /> </td> </tr> <tr> <td style="width: 20px;"> </td> <td style="width: 150px; padding: 1px 2px 1px 2px"> <asp:Label ID="Label3" runat="server" CssClass="formLabel" Height="20px" Text="ID"></asp:Label> </td> <td> <asp:Label ID="tbIndex" Font-Names="Verdana" Font-Size="8pt" runat="server" Text='<%# Bind("Index") %>' Width="50px" ></asp:Label> </td> </tr> <tr> <td style="width: 20px;"> </td> <td style="width: 150px; padding: 1px 2px 1px 2px"> <asp:Label ID="Label6" runat="server" CssClass="formLabel" Height="20px" Text="Device Name"></asp:Label> </td> <td> <asp:TextBox ID="tbAddDeviceName" Width="200px" Text='<%# Bind("DeviceName") %>' Font-Names="verdana" Font-Size="8pt" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="valNewDeviceSubmit" ControlToValidate="tbAddDeviceName" SetFocusOnError="true" ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing Device Name" runat="server"> <img id="Img5" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator> </td> </tr> <tr> <td style="width: 20px;"> </td> <td style="width: 150px; padding: 1px 2px 1px 2px"> <asp:Label ID="Label7" runat="server" CssClass="formLabel" Height="20px" Text="Device Type"></asp:Label> </td> <td> <%-- <telerik:RadComboBox ID="rcbAddDeviceType" runat="server" Font-Names="Verdana" Font-Size="8pt" AllowCustomText="true" MarkFirstMatch="True" NoWrap="True" Skin="Windows7" SortCaseSensitive="False" SelectedValue='<%# Bind("Model") %>' MaxHeight="250px" Width="200px" DataSourceID="dsDeviceTypes" DataTextField="Device_Type" DataValueField="Device_Type" AutoPostBack="False" AppendDataBoundItems="true"> <Items> <telerik:RadComboBoxItem Text="" Value="" /> </Items> </telerik:RadComboBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="rcbAddDeviceType" SetFocusOnError="true" ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing Device Type" runat="server"> <img id="Img1" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator>--%> </td> </tr> <tr> <td style="width: 20px;"> </td> <td> <asp:Label ID="Label8" runat="server" CssClass="formLabel" Height="20px" Text="Cabinet"></asp:Label> </td> <td> <%-- <telerik:RadComboBox ID="rcbAddDeviceCabinet" runat="server" Font-Names="Verdana" AllowCustomText="true" Font-Size="8pt" MarkFirstMatch="True" NoWrap="True" AutoPostBack="False" Skin="Windows7" SortCaseSensitive="False" MaxHeight="250px" Width="200px" DataSourceID="dsCabNums" SelectedValue='<%# Bind("Rack") %>' DataTextField="CabinetNumber" DataValueField="CabinetNumber" AppendDataBoundItems="true" > <Items> <telerik:RadComboBoxItem Text="" Value="" /> </Items> </telerik:RadComboBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="rcbAddDeviceCabinet" SetFocusOnError="true" ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing Cabinet" runat="server"> <img id="Img3" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator>--%> </td> </tr> <tr> <td style="width: 20px;"> </td> <td style="width: 150px; padding: 1px 2px 1px 2px"> <asp:Label ID="Label9" runat="server" CssClass="formLabel" Height="20px" Text="RU Position"></asp:Label> </td> <td> <%-- <asp:TextBox ID="tbRUPosition" Text='<%# Bind("Rack_Position") %>' Width="200px" Font-Names="verdana" Font-Size="8pt" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="tbRUPosition" SetFocusOnError="true" ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing RU Position" runat="server"> <img id="Img4" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator>--%> </td> </tr> <tr> <td style="width: 20px;"> </td> <td colspan="2"> <%--<hr />--%> </td> </tr> <tr> <td colspan="3"> <br /> </td> </tr> </table> <table style="width: 100%"> <tr> <td align="center" colspan="2"> <table> <tr> <td> <telerik:RadButton ID="Button1" ValidationGroup="SaveNewDevice" TabIndex="14" CausesValidation="true" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Save" %>' runat="server" Skin="WebBlue" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'> </telerik:RadButton> </td> <td> <telerik:RadButton ID="btnCancel" CommandName="Cancel" TabIndex="15" Text="Cancel" CausesValidation="False" runat="server" Skin="WebBlue"> </telerik:RadButton> </td> </table> </tr> </td> </tr> </table> </FormTemplate> <EditColumn UniqueName="EditCommandColumn1"> </EditColumn> <FormTableButtonRowStyle HorizontalAlign="Center" /> </EditFormSettings> </MasterTableView> </telerik:RadGrid>protected void grdDevToDev_ItemCommand(object sender, GridCommandEventArgs e) { AssetManagementDataContext dc = new AssetManagementDataContext(); if (e.CommandName == RadGrid.DeleteCommandName) { var index = (int)((GridDataItem)e.Item).GetDataKeyValue("Index"); //retrieve entity form the Db var device = dc.Connections.Where(n => n.Index == index).FirstOrDefault(); if (device != null) { //add the category for deletion dc.Connections.DeleteOnSubmit(device); try { //submit chanages to Db dc.SubmitChanges(); grdAddSwitch.Rebind(); } catch (System.Exception exc) { Response.Write("Error deleting switch.\nError Message: " + exc.Message); } } } }
The 15.1 AjaxControlToolkit release causes an error when Telerik UI for ASP.NET AJAX controls are used together with AjaxControlToolkit controls: "this._setProperties is undefined".
The error stems from the AjaxControlToolkit scripts and Telerik has no control over it. For the time being, there is no possible workaround from our end.
The previous workaround (using the ToolkitScriptManager) is no longer applicable, because the ToolkitScriptManager has been removed.
Ideas we can suggest are:
Recently, the AJAX Toolkit Team announced that standard script manager can no longer be used with their controls.
“- You must use the ToolkitScriptManager instead of the ScriptManager with the Ajax Control Toolkit.”
http://ajaxcontroltoolkit.codeplex.com/releases/view/112805
Since the RadScriptManager is based on the standard asp:ScriptManager, this change makes it not compatible, too. Therefore, to use both of the Telerik UI and AJAX Toolkit control bundles simultaneously within the same project, you have to use the ToolkitScriptManager.
Upon using the toolkit manager, you can come across an error when using an UpdatePanel. We’ve found out that this is due to the ToolkitScriptManager having a bug with script combining. The bug is fixed one day after their latest release:The problem can be reproduced in release mode when scripts are combined and after an AJAX request. The temporary workaround is to set CombineScripts to false:
<asp:ToolkitScriptManager runat="server" ID="ScriptManager1" CombineScripts="false" />