渲染jQuery中对话部分的形式 [英] Render partial form in jQuery dialog

查看:148
本文介绍了渲染jQuery中对话部分的形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你们中的大多数probaly知道Nerddinner.com,我的网页是很像的,所以让我们想象一下这样做是为了的NerdDinner。

Most of you probaly know Nerddinner.com, and my page is much like that, so let's imagine doing this to Nerddinner.

当编辑的晚餐,你会被重定向到晚餐/ Edit.aspx和类型DinnerFormViewModel的局部视图DinnerForm.ascx的presented。

When editing a dinner, you'll be redirected to Dinners/Edit.aspx, and presented of the partial view DinnerForm.ascx of type DinnerFormViewModel.

如果你wan't在一个jQuery UI对话框psented这DinnerForm $ P $?

What if you wan't this DinnerForm presented in a jQuery UI Dialog?

我在想:在你选择要编辑的晚餐的页面,你就会有一个包含局部视图DinnerForm一个div:

I'm thinking: On the page where you choose to edit the dinner, you'll have a div containing the partial view DinnerForm:

<div id="editDinnerForm">
    <% Html.RenderPartial("DinnerForm", chosenDinnerToEdit); %>
</div>

所以,当你选择一个晚宴进行编辑,该div是psented作为一个jQuery UI的对话框$ P $,和所选择的晚餐是考虑到局部视图。 (?!)

So when you select a dinner to edit, that div is presented as a jQuery UI Dialog, and the chosen dinner is given to the partial view. (?!)

我的问题是我怎么能填充局部视图当前晚餐编辑?

My question is how I can populate the partial view the current dinner to edit?

先谢谢了。

推荐答案

我不知道如果我得到你的问题吧,为什么你不能只是通过Ajax的局部视图加载到你的文件吗?在这项事业,你只会有这样的事情:

I'm not sure if I got your problem right, why can't you just load the partial view via Ajax into your document? In this cause you would just have something like this:

<select onchange="$('#editDinnerForm').load(<url>,{dinner:this.value});">
    <option>Dinner1</option>
    <option>Dinner2</option>
</select>

您也可以轻松缓存这些请求,让你不必一次又一次地使这些局部表单做....

You could also easily cache these requests so that you don't have to render these partial forms again and again....

这篇关于渲染jQuery中对话部分的形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆