Hello,
I am trying to run demo example give on demos section for grid.
But I am getting Error:"incorrect syntax near ?"
I tried for all DML.Same Error.
Thanks in advance.
Here is my aspx:--
<telerik:RadGrid ID="RadGrid2" Skin="Hay" runat="server" CssClass="RadGrid" GridLines="None"
AllowPaging="True" PageSize="20" AllowSorting="True" Width="99%" AutoGenerateColumns="False"
ShowStatusBar="true" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
AllowAutomaticUpdates="True" DataSourceID="SessionDataSource2" HorizontalAlign="NotSet"
AllowMultiRowEdit="<%# CheckBox2.Checked %>">
<PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
<MasterTableView CommandItemDisplay="TopAndBottom" GridLines="None" DataSourceID="SessionDataSource2"
DataKeyNames="EmployeeID" EditMode="PopUp">
<Columns>
<telerik:GridEditCommandColumn>
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn UniqueName="TitleOfCourtesy" HeaderText="TOC" DataField="TitleOfCourtesy">
<HeaderStyle Width="60px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="FirstName" HeaderText="FirstName" DataField="FirstName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="LastName" HeaderText="LastName" DataField="LastName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="City" HeaderText="City" DataField="City">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Title" HeaderText="Title" DataField="Title">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="column">
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<FormStyle BackColor="#ECFED8" />
<FormTemplate>
<table id="Table1" cellspacing="1" cellpadding="1" width="250" border="0">
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
FirstName:</td>
<td>
<asp:TextBox ID="TextBox10" Text='<%# Bind( "FirstName") %>' runat="server">
</asp:TextBox></td>
</tr>
<tr>
<td>
Last Name:</td>
<td>
<asp:TextBox ID="TextBox11" Text='<%# Bind( "LastName") %>' runat="server">
</asp:TextBox></td>
</tr>
<tr>
<td>
Title:</td>
<td>
<asp:TextBox ID="TextBox12" Text='<%# Bind( "Title") %>' runat="server">
</asp:TextBox></td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
<tr>
<td>
Country:</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind( "Country" ) %>'>
</asp:TextBox></td>
</tr>
<tr>
<td>
City:</td>
<td>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind( "City") %>'>
</asp:TextBox></td>
</tr>
<tr>
<td>
Region:</td>
<td>
<asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind( "Region") %>'>
</asp:TextBox></td>
</tr>
<tr>
<td>
Title Of Courtesy</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("TitleOfCourtesy") %>'
DataSource='<%# (new string[] { "Dr.", "Mr.", "Mrs.", "Ms." }) %>' AppendDataBoundItems="True"
Style="z-index: 1;">
<asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>
</asp:DropDownList></td>
</tr>
</table>
<table style="width: 100%">
<tr>
<td align="right" colspan="2">
<asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
</asp:Button>
<asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
</asp:Button>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource ID="SessionDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:TESTConnectionString %>" ProviderName="System.Data.SqlClient"
DeleteCommand="DELETE FROM [Employees] WHERE [EmployeeID] = ?" InsertCommand="INSERT INTO [Employees] ([EmployeeID], [LastName], [FirstName], [Title], [TitleOfCourtesy], [City], [Region], [Country]) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [Title], [TitleOfCourtesy], [City], [Region], [Country] FROM [Employees]"
UpdateCommand="UPDATE [Employees] SET [LastName] = ?, [FirstName] = ?, [Title] = ?, [TitleOfCourtesy] = ?, [City] = ?, [Region] = ?, [Country] = ? WHERE [EmployeeID] = ? ">
<UpdateParameters>
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="TitleOfCourtesy" Type="String" />
<asp:Parameter Name="City" Type="String" />
<asp:Parameter Name="Region" Type="String" />
<asp:Parameter Name="Country" Type="String" />
<asp:Parameter Name="original_EmployeeID" Type="Int32" />
</UpdateParameters>
<DeleteParameters>
<asp:Parameter Name="original_EmployeeID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="EmployeeID" Type="Int32" />
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="TitleOfCourtesy" Type="String" />
<asp:Parameter Name="City" Type="String" />
<asp:Parameter Name="Region" Type="String" />
<asp:Parameter Name="Country" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<!-- content end -->
</form>
</body>
I am trying to run demo example give on demos section for grid.
But I am getting Error:"incorrect syntax near ?"
I tried for all DML.Same Error.
Thanks in advance.
Here is my aspx:--
<telerik:RadGrid ID="RadGrid2" Skin="Hay" runat="server" CssClass="RadGrid" GridLines="None"
AllowPaging="True" PageSize="20" AllowSorting="True" Width="99%" AutoGenerateColumns="False"
ShowStatusBar="true" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
AllowAutomaticUpdates="True" DataSourceID="SessionDataSource2" HorizontalAlign="NotSet"
AllowMultiRowEdit="<%# CheckBox2.Checked %>">
<PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
<MasterTableView CommandItemDisplay="TopAndBottom" GridLines="None" DataSourceID="SessionDataSource2"
DataKeyNames="EmployeeID" EditMode="PopUp">
<Columns>
<telerik:GridEditCommandColumn>
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn UniqueName="TitleOfCourtesy" HeaderText="TOC" DataField="TitleOfCourtesy">
<HeaderStyle Width="60px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="FirstName" HeaderText="FirstName" DataField="FirstName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="LastName" HeaderText="LastName" DataField="LastName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="City" HeaderText="City" DataField="City">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Title" HeaderText="Title" DataField="Title">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="column">
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<FormStyle BackColor="#ECFED8" />
<FormTemplate>
<table id="Table1" cellspacing="1" cellpadding="1" width="250" border="0">
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
FirstName:</td>
<td>
<asp:TextBox ID="TextBox10" Text='<%# Bind( "FirstName") %>' runat="server">
</asp:TextBox></td>
</tr>
<tr>
<td>
Last Name:</td>
<td>
<asp:TextBox ID="TextBox11" Text='<%# Bind( "LastName") %>' runat="server">
</asp:TextBox></td>
</tr>
<tr>
<td>
Title:</td>
<td>
<asp:TextBox ID="TextBox12" Text='<%# Bind( "Title") %>' runat="server">
</asp:TextBox></td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
<tr>
<td>
Country:</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind( "Country" ) %>'>
</asp:TextBox></td>
</tr>
<tr>
<td>
City:</td>
<td>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind( "City") %>'>
</asp:TextBox></td>
</tr>
<tr>
<td>
Region:</td>
<td>
<asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind( "Region") %>'>
</asp:TextBox></td>
</tr>
<tr>
<td>
Title Of Courtesy</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("TitleOfCourtesy") %>'
DataSource='<%# (new string[] { "Dr.", "Mr.", "Mrs.", "Ms." }) %>' AppendDataBoundItems="True"
Style="z-index: 1;">
<asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>
</asp:DropDownList></td>
</tr>
</table>
<table style="width: 100%">
<tr>
<td align="right" colspan="2">
<asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
</asp:Button>
<asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
</asp:Button>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource ID="SessionDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:TESTConnectionString %>" ProviderName="System.Data.SqlClient"
DeleteCommand="DELETE FROM [Employees] WHERE [EmployeeID] = ?" InsertCommand="INSERT INTO [Employees] ([EmployeeID], [LastName], [FirstName], [Title], [TitleOfCourtesy], [City], [Region], [Country]) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [Title], [TitleOfCourtesy], [City], [Region], [Country] FROM [Employees]"
UpdateCommand="UPDATE [Employees] SET [LastName] = ?, [FirstName] = ?, [Title] = ?, [TitleOfCourtesy] = ?, [City] = ?, [Region] = ?, [Country] = ? WHERE [EmployeeID] = ? ">
<UpdateParameters>
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="TitleOfCourtesy" Type="String" />
<asp:Parameter Name="City" Type="String" />
<asp:Parameter Name="Region" Type="String" />
<asp:Parameter Name="Country" Type="String" />
<asp:Parameter Name="original_EmployeeID" Type="Int32" />
</UpdateParameters>
<DeleteParameters>
<asp:Parameter Name="original_EmployeeID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="EmployeeID" Type="Int32" />
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="TitleOfCourtesy" Type="String" />
<asp:Parameter Name="City" Type="String" />
<asp:Parameter Name="Region" Type="String" />
<asp:Parameter Name="Country" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<!-- content end -->
</form>
</body>