我有一个复选框列表。当我选择复选框并单击保存按钮时,我想每次刷新列表。 [英] I Have A Checkbox List. I Want To Refresh List At Each Time When I Select Checkbox And Click On Save Button.
本文介绍了我有一个复选框列表。当我选择复选框并单击保存按钮时,我想每次刷新列表。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<asp:CheckBoxList ID="CheckBoxList1" runat="server" DataSourceID="SqlDataSource1"
DataTextField="mname" DataValueField="monthid"
RepeatDirection="Horizontal">
</asp:CheckBoxList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:myconnection %>"
SelectCommand="select monthid,mname from months where monthid not in(SELECT mnameid
FROM InstallmentItem INNER JOIN Installment
ON InstallmentItem.InstallmentID = Installment.InstallmentID
AND InstallmentItem.SessionID = Installment.SessionID
Where (InstallmentItem.SessionID =@sss) )">
<SelectParameters>
<asp:ControlParameter ControlID="HiddenField1" Name="sss"
PropertyName="Value" />
</SelectParameters>
</asp:SqlDataSource>
推荐答案
ConnectionStrings:myconnection %>
SelectCommand = 从monthid不在的月份中选择monthid,mname(SELECT mnameidPropertyName = 价值 / >
FROM InstallmentItem INNER JOIN Installment
ON InstallmentItem.InstallmentID = Installment.InstallmentID
AND InstallmentItem.SessionID = Installment.SessionID
其中(InstallmentItem.SessionID = @ sss)) >
< SelectParameters >
< asp:ControlParameter ControlID = HiddenField1 名称 = sss
< / SelectParameters >
< / asp:SqlDataSource >
ConnectionStrings:myconnection %>" SelectCommand="select monthid,mname from months where monthid not in(SELECT mnameid FROM InstallmentItem INNER JOIN Installment ON InstallmentItem.InstallmentID = Installment.InstallmentID AND InstallmentItem.SessionID = Installment.SessionID Where (InstallmentItem.SessionID =@sss) )"> <SelectParameters> <asp:ControlParameter ControlID="HiddenField1" Name="sss" PropertyName="Value" /> </SelectParameters> </asp:SqlDataSource>
检查您的AutopostBack属性
check your AutopostBack property
AutoPostBack="true"
<asp:checkboxlist id="CheckBoxList1" runat="server" datasourceid="SqlDataSource1"
DataTextField="mname" AutoPostBack="true" DataValueField="monthid"
RepeatDirection="Horizontal">
</asp:checkboxlist>
更多查看此链接
http://asp-net-example.blogspot.in/2009/03 /how-to-use-autopostback-feature-in.html [ ^ ]
在按钮的客户端事件处理程序中,调用checkboxlist控件的DataBind()方法。
例如:
In the client event handler of your button, call the DataBind() method of your checkboxlist control.
For example:
CheckBoxList1.DataBind();
这篇关于我有一个复选框列表。当我选择复选框并单击保存按钮时,我想每次刷新列表。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文