1

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 を =="rptSelectedUtilities" に設定したので、スクリプトに追加する必要がありますが、私は初心者なので、助けていただければ幸いです。

ありがとう

4

1 に答える 1

1

これをリアルタイムにする必要がある場合は、signalrを確認することをお勧めします。学習段階の早い段階でこれを噛み砕くのは大変かもしれませんが、現在、代わりにシグナルを使用するためにすべての ajax 呼び出しを切り替えています。

于 2013-03-08T15:55:35.997 に答える