need sample of jquery modal dialog content loaded from controller action
-
21-09-2019 - |
문제
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.
해결책
You have to create a different action that returns the "DB content":
public SomeController : Controller
{
public ActionResult DatabaseData()
{
var model = getDatabaseData();
return View(model);
}
}
And create the corresponding view, that displays the data in a div.
After this you can load the result of this action in your dialog:
$('#id-of-dialog-element')
.load('<%=Url.Action("DatabaseData", "SomeController")%>')
.dialog('open');
Alternatively, you could return the DB data as JSON and render the data in a table on the client.
제휴하지 않습니다 StackOverflow