or
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> </telerik:RadScriptManager> <div style="width: 500px;"> <telerik:RadGrid ID="RadGrid1" runat="server" OnInsertCommand="RadGrid1_InsertCommand" OnNeedDataSource="RadGrid1_NeedDataSource" OnUpdateCommand="RadGrid1_UpdateCommand" OnItemCommand="RadGrid1_ItemCommand"> <MasterTableView AutoGenerateColumns="false" CommandItemDisplay="Bottom"> <Columns> <telerik:GridBoundColumn UniqueName="Number" DataField="Number" HeaderText="Number"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="Title" DataField="Title" HeaderText="Title"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="Description" DataField="Description" HeaderText="Description"> </telerik:GridBoundColumn> <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"> </telerik:GridEditCommandColumn> </Columns> <EditFormSettings EditFormType="Template"> <FormTemplate> <table> <tr> <td class="textb"> Number </td> <td> <telerik:RadNumericTextBox ID="RadNumericTextBoxNumber" runat="server" Text='<%# Bind("Number") %>' NumberFormat-DecimalDigits="0" DataType="System.Int32"> </telerik:RadNumericTextBox> </td> </tr> <tr> <td class="textb"> Title </td> <td> <telerik:RadTextBox ID="RadTextBoxTitle" runat="server" MaxLength="1024" Text='<%# Bind("Title") %>'> </telerik:RadTextBox> </td> </tr> <tr> <td class="textb"> Description </td> <td> <telerik:RadTextBox ID="RadTextBoxDescription" runat="server" MaxLength="1024" TextMode="MultiLine" Text='<%# Bind("Description") %>'> </telerik:RadTextBox> </td> </tr> </table> <br /> <br /> <asp:Button CommandName="Cancel" ID="Button1" runat="server" Text="Cancel"></asp:Button> <asp:Button ID="Button2" Text="OK" runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' /> </FormTemplate> </EditFormSettings> </MasterTableView> </telerik:RadGrid> </div>protected RegistrationLine DefaultRegistrationLine() { RegistrationLine dr = new RegistrationLine(); dr = new RegistrationLine(); dr.Number = 0; dr.Title = ""; dr.Description = ""; return dr; } protected class RegistrationLine { public int Number { get; set; } public string Title { get; set; } public string Description { get; set; } } protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { tempListRegistrationLines = RadGridBindStartUpData(); } } protected static List<RegistrationLine> tempListRegistrationLines; private List<RegistrationLine> RadGridBindStartUpData() { List<RegistrationLine> list = new List<RegistrationLine>(); RegistrationLine rl; rl = new RegistrationLine(); rl.Number = 1; rl.Title = "A"; rl.Description = "aaa"; list.Add(rl); rl = new RegistrationLine(); rl.Number = 2; rl.Title = "B"; rl.Description = "bbb"; list.Add(rl); rl = new RegistrationLine(); rl.Number = 3; rl.Title = "C"; rl.Description = "ccc"; list.Add(rl); return list; } protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { RadGrid1.DataSource = tempListRegistrationLines; } protected void RadGrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { GridEditableItem editedItem = e.Item as GridEditableItem; List<RegistrationLine> table = tempListRegistrationLines; RegistrationLine newRow = new RegistrationLine(); RadTextBox rtb; rtb = (RadTextBox)editedItem.FindControl("RadTextBoxTitle"); newRow.Title = rtb.Text; rtb = (RadTextBox)editedItem.FindControl("RadTextBoxDescription"); newRow.Description = rtb.Text; RadNumericTextBox number = (RadNumericTextBox)editedItem.FindControl("RadNumericTextBoxNumber"); newRow.Number = number.Value.HasValue ? Convert.ToInt32(number.Value.Value) : 0; table.Add(newRow); } protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) { GridEditableItem editedItem = e.Item as GridEditableItem; int idx = e.Item.ItemIndex; List<RegistrationLine> table = tempListRegistrationLines; table.RemoveAt(idx); RegistrationLine newRow = new RegistrationLine(); RadTextBox rtb; rtb = (RadTextBox)editedItem.FindControl("RadTextBoxTitle"); newRow.Title = rtb.Text; rtb = (RadTextBox)editedItem.FindControl("RadTextBoxDescription"); newRow.Description = rtb.Text; RadNumericTextBox number = (RadNumericTextBox)editedItem.FindControl("RadNumericTextBoxNumber"); newRow.Number = number.Value.HasValue ? Convert.ToInt32(number.Value.Value) : 0; table.Insert(idx,newRow); } protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) { string strCommand = e.CommandName; if (strCommand == RadGrid.InitInsertCommandName) { // prepare for insert: default data e.Canceled = true; RegistrationLine rl = DefaultRegistrationLine(); e.Item.OwnerTableView.InsertItem(rl); } if (strCommand == "Edit") { GridEditFormItem editItem = e.Item as GridEditFormItem; // nothing } }<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="oPeriodos" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" Culture="Spanish (Mexico)" GridLines="None" Skin="Hay" PageSize="12" CellPadding="3" Width="800px" AllowAutomaticDeletes="True" ShowFooter="True" AllowAutomaticUpdates="true" > <MasterTableView DataSourceID="oPeriodos" CellPadding="3" Width="800px" DataKeyNames="OIG003_ID_BI" EditMode="PopUp"> <Columns> <telerik:GridEditCommandColumn EditText="Editar"> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="OIG003_ID_BI" UniqueName="ID" HeaderText="ID" Resizable="False" Visible="false"> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="100px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="OIG001_Mes_ST" UniqueName="Mes" HeaderText="Mes" Resizable="False"> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="100px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="OIG003_Anio_IN" UniqueName="Ano" HeaderText="Año" Resizable="False"> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="100px" /> </telerik:GridBoundColumn> <telerik:GridCheckBoxColumn DataField="OIG003_Cerrado_BO" UniqueName="Cerrado" HeaderText="Cerrado" Resizable="false"> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="100px" HorizontalAlign="Center" VerticalAlign="Middle"/> </telerik:GridCheckBoxColumn> <telerik:GridBoundColumn DataField="OIG003_FechaCierre_DT" UniqueName="FechaCierre" HeaderText="Fecha de Apertura / Cierre" Resizable="False" DataFormatString="{0:MM/dd/yyyy hh:mm:ss}" > <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="150px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="OSEG001_NOMBRE_ST" UniqueName="Usuario" HeaderText="Usuario" Resizable="False"> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="300px" /> </telerik:GridBoundColumn> <telerik:GridButtonColumn ConfirmText="¿Confirma la eliminación del Tipo de Cambio Seleccionado?" ConfirmDialogType="RadWindow" ConfirmTitle="Eliminar" ButtonType="ImageButton" CommandName="Delete" Text="Eliminar" UniqueName="DeleteColumn"> <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> </telerik:GridButtonColumn> </Columns> <EditFormSettings InsertCaption="Cerrar Periodo" CaptionFormatString="Periodo: {0}" CaptionDataField="OIG003_ID_BI" EditFormType="Template" PopUpSettings-Modal="true"> <FormTemplate> <table id="Table1" cellspacing="1" cellpadding="1" width="250" border="0" runat="server"> <tr> <td> </td> <td> </td> </tr> <tr> <td> Cerrado: </td> <td> <asp:CheckBox ID="chkCerrado" runat="server" Checked='<%# Bind("OIG003_Cerrado_BO") %>' /> </td> </tr> </table> <table style="width: 100%"> <tr> <td align="right" colspan="2"> <asp:Button ID="Button1" Text="Actualizar" runat="server" CommandName="Update" CausesValidation="false" > </asp:Button> <asp:Button ID="Button2" Text="Cancelar" runat="server" CausesValidation="False" CommandName="Cancel"> </asp:Button> </td> </tr> </table> </FormTemplate> </EditFormSettings> <CommandItemSettings ExportToPdfText="Export to Pdf" /> </MasterTableView> <ClientSettings> <ClientEvents OnRowDblClick="RowDblClick" /> </ClientSettings> </telerik:RadGrid><telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="oPeriodos" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" Culture="Spanish (Mexico)" GridLines="None" Skin="Hay" PageSize="12" CellPadding="3" Width="800px" AllowAutomaticDeletes="True" ShowFooter="True" AllowAutomaticUpdates="true" > <MasterTableView DataSourceID="oPeriodos" CellPadding="3" Width="800px" DataKeyNames="OIG003_ID_BI" EditMode="PopUp"> <Columns> <telerik:GridEditCommandColumn EditText="Editar"> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="OIG003_ID_BI" UniqueName="ID" HeaderText="ID" Resizable="False" Visible="false"> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="100px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="OIG001_Mes_ST" UniqueName="Mes" HeaderText="Mes" Resizable="False"> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="100px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="OIG003_Anio_IN" UniqueName="Ano" HeaderText="Año" Resizable="False"> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="100px" /> </telerik:GridBoundColumn> <telerik:GridCheckBoxColumn DataField="OIG003_Cerrado_BO" UniqueName="Cerrado" HeaderText="Cerrado" Resizable="false"> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="100px" HorizontalAlign="Center" VerticalAlign="Middle"/> </telerik:GridCheckBoxColumn> <telerik:GridBoundColumn DataField="OIG003_FechaCierre_DT" UniqueName="FechaCierre" HeaderText="Fecha de Apertura / Cierre" Resizable="False" DataFormatString="{0:MM/dd/yyyy hh:mm:ss}" > <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="150px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="OSEG001_NOMBRE_ST" UniqueName="Usuario" HeaderText="Usuario" Resizable="False"> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> <ItemStyle Width="300px" /> </telerik:GridBoundColumn> <telerik:GridButtonColumn ConfirmText="¿Confirma la eliminación del Tipo de Cambio Seleccionado?" ConfirmDialogType="RadWindow" ConfirmTitle="Eliminar" ButtonType="ImageButton" CommandName="Delete" Text="Eliminar" UniqueName="DeleteColumn"> <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> </telerik:GridButtonColumn> </Columns> <EditFormSettings InsertCaption="Cerrar Periodo" CaptionFormatString="Periodo: {0}" CaptionDataField="OIG003_ID_BI" EditFormType="Template" PopUpSettings-Modal="true"> <FormTemplate> <table id="Table1" cellspacing="1" cellpadding="1" width="250" border="0" runat="server"> <tr> <td> </td> <td> </td> </tr> <tr> <td> Cerrado: </td> <td> <asp:CheckBox ID="chkCerrado" runat="server" Checked='<%# Bind("OIG003_Cerrado_BO") %>' /> </td> </tr> </table> <table style="width: 100%"> <tr> <td align="right" colspan="2"> <asp:Button ID="Button1" Text="Actualizar" runat="server" CommandName="Update" CausesValidation="false" > </asp:Button> <asp:Button ID="Button2" Text="Cancelar" runat="server" CausesValidation="False" CommandName="Cancel"> </asp:Button> </td> </tr> </table> </FormTemplate> </EditFormSettings> <CommandItemSettings ExportToPdfText="Export to Pdf" /> </MasterTableView> <ClientSettings> <ClientEvents OnRowDblClick="RowDblClick" /> </ClientSettings> </telerik:RadGrid>public override string GetPath(string path){ // First add the '~/' signs in order to use the VirtualPathUtility.GetDirectory() method ; /*string PathWithTilde = "~/" + path; string virtualPath = VirtualPathUtility.GetDirectory(PathWithTilde); virtualPath = virtualPath.Remove(0, 2);// remove the '~' signs return virtualPath;*/ string virtualPath = ""; if (Path.GetFileName(path).Length > 0) virtualPath = path.Replace(Path.GetFileName(path), ""); return virtualPath;}
Hi, I'm getting the following page error when selecting a row from RadGrid to display content in a separate pane using ajax manager. This error only appears when published to a a web server not on local development server.
----------------------------------------------------
Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; BRI/1; InfoPath.2; .NET4.0C; .NET4.0E; MALC) Timestamp: Sat, 15 Jan 2011 23:43:05 UTC Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near ' <!DOCTYPE html P'. Line: 6 Char: 84093 Code: 0 URI: http://host/pro2/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a1f68db6e-ab92-4c56-8744-13e09bf43565%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-US%3aaa801ad7-53c4-4f5c-9fd3-11d99e4b92f4%3a16e4e7cd%3af7645509%3a22a6274a%3aed16cbdc%3a11a04f7e%3a24ee1bba%3af46195d3%3a1e771326%3aa7e79140%3ae524c98b%3a874f8ea2%3a19620875%3a490a9d4e%3a407acb1c%3ae330518b%3ac8618e41%3ae4f8f289%3a58366029%3a7165f74%3a86526ba7%3abd8f85e4