0

我对 radlistview 的编辑有疑问。在编辑 radlistview 中包含组合框。如何设置组合框的值并将编辑 radlistview 的值更新到数据库。

我有代码 asp.net:

<telerik:RadListView ID="RadListView2" runat="server" Width="100%" DataSourceID="SqlDataSource2" AllowPaging="True" PageSize="5" DataKeyNames="bc_truongcap">
        <LayoutTemplate>
            <div class="RadListView RadListView_Default">
                <table style="width: 100%;">
                    <thead>
                        <tr class="rlvHeader">
                            <td>Chỉnh sửa
                            </td>
                            <td>Trường</td>
                            <td>Khối ngành</td>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <td>
                                <telerik:RadDataPager ID="RadDataPager1" runat="server" PageSize="3">
                                    <Fields>
                                        <telerik:RadDataPagerButtonField FieldType="Numeric" />
                                    </Fields>
                                </telerik:RadDataPager>
                            </td>
                        </tr>
                    </tfoot>
                    <tbody>
                        <tr id="itemPlaceholder" runat="server">
                        </tr>
                    </tbody>
                </table>
            </div>
        </LayoutTemplate>
        <ItemTemplate>
            <tr class="rlvI">
                <td>
                    <asp:LinkButton ID="LinkButton1" CommandName="Edit" runat="server">Đổi</asp:LinkButton></td>
                <td><%#Eval("bc_truongcap") %></td>
                <td><%#Eval("bc_loaibang") %></td>
            </tr>
        </ItemTemplate>
        <EditItemTemplate>
            <tr class="rlvIEdit">
                <td>
                    <fieldset>
                        Thay đổi Bằng
                                <table>
                                    <tr>
                                        <td>Trường cấp</td>
                                        <td><%#Eval("bc_truongcap")  %></td>
                                    </tr>
                                    <tr>
                                        <td>Loại bằng</td>
                                        <td>
                                            <telerik:RadComboBox ID="bangcap" Text='<%#Bind("bc_truongcap")%>' runat="server" Skin="Office2007">
                                                <Items>
                                                    <telerik:RadComboBoxItem runat="server" Text="Phổ thông" Value="Phổ thông" Selected='<%#Eval("bc_truongcap") =="Phổ thông" ? true :false   %>' />
                                                    <telerik:RadComboBoxItem runat="server" Text="Trung cấp" Value="Trung cấp" Selected='<%#Eval("bc_truongcap") =="Trung cấp" ? true :false   %>' />
                                                    <telerik:RadComboBoxItem runat="server" Text="Cao đẳng" Value="Cao đẳng" />
                                                    <telerik:RadComboBoxItem runat="server" Text="Đại học" Value="Đại học" />
                                                    <telerik:RadComboBoxItem runat="server" Text="Thạc sĩ" Value="Thạc sĩ" />
                                                    <telerik:RadComboBoxItem runat="server" Text="Khác" Value="Khác" />
                                                </Items>
                                            </telerik:RadComboBox>
                                            <%--<asp:TextBox ID="TextBox2" runat="server" Text='<%#Bind("bc_loaibang")  %>'>
                                            </asp:TextBox>--%></td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:LinkButton ID="LinkButton2" runat="server" CommandName="update">Cập nhập</asp:LinkButton></td>
                                        <td>
                                            <asp:LinkButton ID="LinkButton3" runat="server" CommandName="cancel">Thoát</asp:LinkButton></td>
                                    </tr>
                                </table>
                    </fieldset>
                </td>
            </tr>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <div class="RadListView RadListView_Default">
                <div class="rlvEmpty">
                    Chưa có cập nhập băng cấp.
                </div>

                </div>
            </EmptyDataTemplate>
        </telerik:RadListView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:InterFindWorkConnectionString %>"
        SelectCommand="SELECT id_nganh, bc_truongcap, bc_loaibang FROM BangCap WHERE (id_gmailntv = @id_gmailntv) AND (bc_status = 0)" UpdateCommand="Update Bangcap set bc_truongcap=@bc_truongcap , bc_loaibang = @bc_loaibang where bc_truongcap=@bc_truongcap ">
        <SelectParameters>
            <asp:SessionParameter Name="id_gmailntv" SessionField="user" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="bc_truongcap" />
            <asp:Parameter Name="bc_loaibang" />
        </UpdateParameters>
    </asp:SqlDataSource>

如何使用所选组合框的值更新到数据库?

4

1 回答 1

0

检查Telerik KB中 ListView 线程中的双向数据绑定。

于 2013-09-16T10:40:50.563 回答