0

My ASP.NET MVC app opens and displays the dialog fine however I can't figure out how to get DB content into it. I have read about making an ajax call to get the data. My disconnect is how it gets displayed in my . Any links where this is done (full code).

Thanks.

4

1 に答える 1

1

「DB コンテンツ」を返す別のアクションを作成する必要があります。

public SomeController : Controller 
{
  public ActionResult DatabaseData()
  {
    var model = getDatabaseData();
    return View(model);
  }
}

そして、div にデータを表示する対応するビューを作成します。

この後、このアクションの結果をダイアログにロードできます。

$('#id-of-dialog-element')
  .load('<%=Url.Action("DatabaseData", "SomeController")%>')
  .dialog('open');

または、DB データを JSON として返し、データをクライアントのテーブルにレンダリングすることもできます。

于 2009-10-13T14:21:09.370 に答える