gridview更新命令不起作用

时间:2015-01-02 13:26:01

标签: c# asp.net gridview

我有一个gridview,我正在尝试启用更新选项。谷歌搜索我记得的一切,没有任何效果。

这里是gridview和数据源的代码:

        <asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:SqlDataSource  id="sqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ab5301_b1ConnectionString %>" ProviderName="<%$ ConnectionStrings:ab5301_b1ConnectionString.ProviderName %>" SelectCommand="SELECT name AS NAME, id AS ID FROM checkins WHERE (location = @selectedPlace)" UpdateCommand="UPDATE checkins SET name = @NAME WHERE (id = @ID)">
                    <SelectParameters>
                        <asp:ControlParameter Name="selectedPlace" ControlID="gridView" PropertyName="SelectedValue" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="NAME" type="String"/>
                        <asp:Parameter Name="ID" type="Int32"/>
                    </UpdateParameters>
                </asp:SqlDataSource>
                <asp:GridView runat="server" DataKeyNames="ID" ID="gridView2" DataSourceID="sqlDataSource2"  AutoGenerateColumns="true" EnableViewState="false" AutoGenerateEditButton="true" PageSize="5" AllowPaging="true" PagerSettings-NextPageText="NEXT" PagerSettings-PreviousPageText="PREV" PagerSettings-Mode="NextPrevious"></asp:GridView> <!----> 
            </ContentTemplate>
        </asp:UpdatePanel>

0 个答案:

没有答案