使用ASP。. NET我使用中继器在屏幕上显示DB表。
我希望用户能够选中或取消选中一个复选框(表中的字段)。在Management Studio中实时更新DB中的相应字段.....
通过谷歌搜索。JQuery似乎是解决之道....到目前为止,我得到了……
后面的代码:
//GetUtilityCompanyNames() returns a list of all the companies names
rptSelectedUtilities.DataSource = GetUtilityCompanyNames();
rptSelectedUtilities.DataBind();
在aspx: <asp:Repeater id="rptSelectedUtilities" runat="server" DataSourceID="rptSelectedUtilities">
<HeaderTemplate>
<table class="detailstable FadeOutOnEdit">
<tr>
<th style="width:200px;">Utility</th>
<th style="width:200px;">Contacted</th>
<th style="width:200px;">Comment</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<th style="width:200px;"><%# Eval("Name") %></th>
<th style="width:200px;"><asp:CheckBox ID="chkMyCheck" runat="server" Checked='<%# Convert.ToBoolean(Eval("Checked")) %>'/></th>
<th style="width:200px;"><%# Eval("Comment") %></th>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Label id="labelTableEmpty" runat="server" Text="There are currently no items in this table." />
<script type="text/javascript">
$('bla').
//不知道如何从这里开始?
我已经将重复器上的DataSourceID设置为=" rptselecteutilities ",然后我需要在脚本中添加,但我是初学者,请提供任何帮助。
谢谢
如果你真的需要这是实时的,我建议看看signalr。在您学习的早期阶段,可能会有很多事情要做,但我目前正在将所有ajax调用切换为使用signalr。