1

使用 ASP.NET 我使用中继器在屏幕上显示数据库表。

我希望用户能够选中或取消选中复选框(表中的字段)。在 Management Studio 中实时更新数据库中的相应字段......

通过谷歌查看。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 设置为 =“rptSelectedUtilities”,然后我需要添加脚本,但我是这方面的初学者,希望有任何帮助。

谢谢

4

1 回答 1

1

If you are really needing this to be realtime I would suggest looking at signalr. It might be a lot to bite off this early in your learning stage but I am currently switching out all of my ajax calls to use signalr instead.

于 2013-03-08T15:55:35.997 回答