I have problems to erase a register from a RADGRID, associated to a SessionDataSource, which I use temporarily, playing the role of a “recipient“ ( just insert and delete).
The code the .aspx for the SessionDataSource is as below:
<sds:SessionDataSource DisplayWarning = "False" PrimaryKeyFields = "dp_key" ProviderName = "System.Data.SqlClient" ID = "devis" runat = "server" ConnectionString = "<%$ ConnectionStrings:string_Connection %>" ConflictDetection = "CompareAllValues" OldValuesParameterFormatString = "original_{0}" SelectCommand="SELECT * FROM [devis] ORDER BY dp_key" DeleteCommand="DELETE FROM [devis] WHERE [dp_key] = ?" InsertCommand="INSERT INTO devis(dp_codeprd, dp_nombre, dp_convives, dp_prixs, dp_prixs_unitaire) VALUES (?, ?, ?, ?, ? )" > <DeleteParameters> <asp:Parameter Name="original_dp_key" Type="Int32" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="dp_codeprd" Type="String" /> <asp:Parameter Name="dp_nombre" Type="String" /> <asp:Parameter Name="dp_convives" Type="Int16" /> <asp:Parameter Name="dp_prixs" Type="Decimal" /> <asp:Parameter Name="dp_prixs_unitaire" Type="Decimal" /> </InsertParameters> </sds:SessionDataSource> The code the .aspx for RadGrid is as below:
<telerik:RadGrid ShowFooter = "false" ID = "devis_prd" runat = "server" DataSourceID = "devis" Width = "100%" AllowPaging = "True" PageSize = "10" AllowSorting = "false" GridLines = "None" AllowAutomaticDeletes = "True" AllowAutomaticInserts = "True" AllowAutomaticUpdates = "True" onitemdatabound = "devis_prd_ItemDataBound" > <HeaderContextMenu EnableTheming="True"> <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> </HeaderContextMenu> <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst" DataKeyNames="dp_key, dp_codeprd, dp_nombre, dp_convives, dp_prixs, dp_prixs_unitaire" HorizontalAlign="NotSet" Name="devis_prd" NoDetailRecordsText="Aucun produit sélectionné !" NoMasterRecordsText="Votre devis est vide !" Width="100%"> <Columns> <telerik:GridBoundColumn DataField="dp_key" DataType="System.Int32" HeaderText="Id " ReadOnly="True" SortExpression="dp_key" UniqueName="dp_key" Visible="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="dp_CodePrd" DataFormatString="{0:LLL-LL-000}" DataType="System.String" HeaderText="Code Produit" UniqueName="dp_CodePrd"> <HeaderStyle HorizontalAlign="Center" /> <ItemStyle HorizontalAlign="Center" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="dp_nombre" DataType="System.String" HeaderText="Nom du Produit" SortExpression="dp_nombre" UniqueName="dp_nombre"> <HeaderStyle HorizontalAlign="Left" /> <ItemStyle HorizontalAlign="Left" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="dp_convives" DataType="System.Int32" HeaderText="Convives" SortExpression="dp_convives" UniqueName="dp_convives"> <HeaderStyle HorizontalAlign="Right" /> <ItemStyle CssClass="monto_grid" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="dp_prixs" DataFormatString="{0:C2}" DataType="System.Decimal" HeaderText="Prix de la Paella" SortExpression="dp_prixs" UniqueName="dp_prixs"> <HeaderStyle HorizontalAlign="Right" /> <ItemStyle CssClass="monto_grid" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="dp_prixs_unitaire" DataFormatString="{0:C2}" DataType="System.Decimal" HeaderStyle-Width="120" HeaderText="Prix unitaire " SortExpression="dp_prixs_unitaire" UniqueName="dp_prixs_unitaire"> <HeaderStyle HorizontalAlign="Right" /> <ItemStyle CssClass="monto_grid" /> </telerik:GridBoundColumn> <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmDialogType="RadWindow" ConfirmText="Cette action permet de supprimer le produit sélectionné de votre devis. <br/><br/>Etes-vous sûr ? <br/><br/>" Text="Supprimer ce produit" UniqueName="DeleteColumn"> <HeaderStyle Width="20px" /> <ItemStyle CssClass="MyImageButton" HorizontalAlign="Center" /> </telerik:GridButtonColumn> </Columns> </MasterTableView> <PagerStyle Mode="NextPrevAndNumeric" /> </telerik:RadGrid> The insert I do it with the code behind and it works without any problem:
public void Insert_Devis(object source, EventArgs e) { devis.InsertParameters["dp_codeprd"].DefaultValue = Code_PRD(); devis.InsertParameters["dp_nombre"].DefaultValue = Produits_ID.Text; devis.InsertParameters["dp_convives"].DefaultValue = RadComboBox1.Text; devis.InsertParameters["dp_prixs"].DefaultValue = (Convert.ToDouble(RadComboBox1.SelectedValue) * Convert.ToInt16(RadComboBox1.Text)).ToString(); devis.InsertParameters["dp_prixs_unitaire"].DefaultValue = RadComboBox1.SelectedValue.ToString(); devis.Insert(); } But at the moment of deleting a registry from the “recipient” (RadGrid) I get the following message:
“Mensaje: Sys.WebForms.PageRequestManagerServerErrorException: Error de sintaxis en la expresión.
Línea: 3
Carácter: 74672
Código: 0
URI: http://subtest.test.com/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.40412.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aes-ES%3aacfc7575-cdee-46af-964f-5d85d9cdcf92%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.3.1109.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aes-ES%3a30468509-1b07-456a-b5f4-bb35a9cae168%3a16e4e7cd%3a874f8ea2%3af7645509%3a24ee1bba%3af46195d3%3a19620875%3a490a9d4e%3abd8f85e4%3a86526ba7%3ae330518b%3a1e771326%3ac8618e41%3aed16cbdc%3a39040b5c%3af85f9819%3ab7778d6c%3a82923ac3%3bAjaxControlToolkit%2c+Version%3d4.1.40412.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aes-ES%3aacfc7575-cdee-46af-964f-5d85d9cdcf92%3a923aa3cc%3a853c2e0b%3a46f97eb1%3a782b16ab%3a535785ef »
Please help me to solve this problem.
Thanks for your help,
Jorge Saa-Gerbier
