编辑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>
如何使用所选组合框的值更新到数据库?