第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何為網(wǎng)頁實(shí)現(xiàn)實(shí)時(shí)數(shù)據(jù)

如何為網(wǎng)頁實(shí)現(xiàn)實(shí)時(shí)數(shù)據(jù)

手掌心 2019-11-30 14:08:59
我有一個(gè)在ASP.NET中實(shí)現(xiàn)的數(shù)據(jù)表。我想在頁面上實(shí)時(shí)或接近實(shí)時(shí)顯示對(duì)此基礎(chǔ)數(shù)據(jù)的更改。我該怎么辦?我的模特:public class BoardGame    {    public int Id { get; set;}    public string Name { get; set;}    public string Description { get; set;}    public int Quantity { get; set;}    public double Price { get; set;}    public BoardGame() { }    public BoardGame(int id, string name, string description, int quantity, double price)        {        Id=id;        Name=name;        Description=description;        Quantity=quantity;        Price=price;        }    }代替此示例的實(shí)際數(shù)據(jù)庫,我將把數(shù)據(jù)存儲(chǔ)在Application變量中。我將其Application_Start植入我的Global.asax.cs函數(shù)中。var SeedData = new List<BoardGame>(){    new BoardGame(1, "Monopoly","Make your opponents go bankrupt!", 76, 15),    new BoardGame(2, "Life", "Win at the game of life.", 55, 13),    new BoardGame(3, "Candyland", "Make it through gumdrop forrest.", 97, 11)    };Application["BoardGameDatabase"] = SeedData;如果使用的是Web窗體,則將使用中繼器顯示數(shù)據(jù)。<h1>Board Games</h1>        <asp:Repeater runat="server" ID="BoardGameRepeater" ItemType="RealTimeDemo.Models.BoardGame">            <HeaderTemplate>                <table border="1">                    <tr>                        <th>Id</th>                        <th>Name</th>                        <th>Description</th>                        <th>Quantity</th>                        <th>Price</th>                    </tr>            </HeaderTemplate>            <ItemTemplate>                <tr>                    <td><%#: Item.Id %></td>                    <td><%#: Item.Name %></td>                    <td><%#: Item.Description %></td>                    <td><%#: Item.Quantity %></td>                    <td><%#: Item.Price %></td>                </tr>            </ItemTemplate>            <FooterTemplate></table></FooterTemplate>        </asp:Repeater>并在后面的代碼中加載該數(shù)據(jù):protected void Page_Load(object sender, EventArgs e)    {    BoardGameRepeater.DataSource = Application["BoardGameDatabase"];    BoardGameRepeater.DataBind();    }
查看完整描述

3 回答

  • 3 回答
  • 0 關(guān)注
  • 775 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)