0
我想重複使用popup.cshtml,當我點擊index.cshtml頁面上的actionlink時。當我點擊類別ID操作鏈接時,我可以看到帶有2個文本框的彈出框並提交按鈕,該按鈕將數據插入到類別下拉列表中。MVC3 jquery popup resuable視圖
我想的一樣彈出來了作業ID動作鏈接被點擊的時候,但插入作業ID下拉。
請幫我
Index.cshtml
<td>
@Html.DropDownList("CategoryID")
@Html.ActionLink("New test", "Popup", "Home", null, new { @class = "openPopup", data_dialog_id = "popuplDialog", data_dialog_title = "Add New" })
</td>
<td>
@Html.DropDownList("JobID")
@Html.ActionLink("New", "Popup", "Home", null, new { @class = "openPopup", data_dialog_id = "popuplDialog", data_dialog_title = "Popup" })
</td>
Popup.cshtml
@model MVC3.Models.ValidationModel
@{
ViewBag.Title = "Popup";
Layout = null;
}
<script type="text/javascript">
$(document).ready(function() {
$('#subbutton').live("click", function() {
var code = $("#txtCode").val();
var value = $
var characterReg = /^[A-Za-z0-9 _]*[A-Za-z0-9][A-Za-z0-9 _]*$/;
if (!characterReg.test(inputVal)) {
$('#codelbl').text("*");
return false;
}
if (!characterReg.test(inputVal)) {
$('#codelbl').text("*");
return false;
}
// $(this).closest(".dialog").dialog("close");
// alert("test1");
});
});
</script>
@{
ViewBag.Title = "";
}
@using (Html.BeginForm())
{
<table>
<tr>
<td>
<label> Code</label>
</td>
<td>
@Html.TextBox("txtCode")
<label id="codelbl" style="color:Red"></label>
</td>
</tr>
<tr>
<td>
<label>Name</label>
</td>
<td>
@Html.TextBox("txtName")
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input id="subbutton" type="submit" value="Insert" />
</td>
</tr>
</table>
}
我應該如何使用隱藏輸入? – Priya
''然後用JavaScript設置它的值;然後閱讀它,並使用該選擇器的子按鈕單擊事件下拉 – RebelFist
我通過它作爲參數通過行動鏈接...謝謝.... – Priya