如何将参数传递给ASP模态用户控件

时间:2014-12-10 22:15:00

标签: javascript asp.net-mvc

- 我如何在此代码中使用下一个句子来使用参数而不是CURRENT_USER.ACCOUNID  的 MediaSuite.Web.UI.Code.CurrentUser)会话[" CURRENT_USER&#34]。)ACCOUNTID

- 如何从Javascript传递该参数显然在调用模态之前

<% var accountAlerts = MediaSuite.BusinessLayer.Accounts.AccountAlertRecord.GetRecords(((MediaSuite.Web.UI.Code.CurrentUser)Session["current_user"]).AccountId).Data; %>
<div class="modal hide fade" id="accountSetAlertsModal" style="width:500px;height:600px;overflow:hidden;">
<% using (Html.BeginForm("SetAlerts", "Accounts", null, FormMethod.Post, new { @id = "AccountSetAlertsModal" }))
   { %>
    <div class="modal-header" >
        <div class="navbar navbar-static navbar_as_heading">
            <div class="navbar-inner">
                <div class="container" style="width: auto; color: White; font-family: sans-serif; font-size: 2em; padding-top: 10px" >
                    <!-- <button type="button" class="icon-remove-sign" data-dismiss="modal" aria-hidden="true">&times;</button> -->
                    <span style="float:left;margin-left:2px;margin-top:3px;">
                        Set Alerts
                    </span>
                    <span class="icon-remove-sign" data-dismiss="modal" aria-hidden="true" 
                        style="float:right;margin-right:10px;cursor:pointer;"></span>
                </div>    
            </div>
        </div>           
    </div>
    <div class="modal-body"> 
            <table cellpadding="15px" cellspacing="0" border="0" class="display table table-striped  table-bordered small-font"  id="gridAlerts"> 
            <thead>
                <tr>
                    <th>
                        Description 
                    </th>
                    <th>
                        Active?
                    </th>
                    <th>
                        Type
                    </th>
                </tr>

         <% TempData["accountAlerts"] = accountAlerts; %>                                                             
         <% foreach (var alert in accountAlerts)
            {    
         %>
     <%--<table cellpadding="0" cellspacing="0" border="0" class="display table table-striped table-bordered small-font" >--%>
<%--<table>--%>
<tr>
                      <td>
                            <%= alert.Description %>
                     </td>
            <% if (alert.Selected)
               { %>              
                     <td>
                            <input type="checkbox" value="<%= alert.AccountAlertId  %>" name="AlertSelected" checked="checked" /> 
                     </td>

                <%--<input type="checkbox" value="<%= alert.AccountAlertId  %>" name="AlertSelected" checked="checked" /> <%= alert.Description %> <br /> --%>               
            <% }
               else
               { %>

     <%--             <td>
                            <%= alert.Description %>
                     </td>--%>
                     <td>
                           <input type="checkbox"  value="<%= alert.AccountAlertId  %>" name="AlertSelected"/> 
                     </td>

              <%-- <input type="checkbox"  value="<%= alert.AccountAlertId  %>" name="AlertSelected"/> <%= alert.Description %> <br />--%>
            <% } %>
            <td>
            alert.AlertTypeId            
            </td>

        <% } %>     
  </tr>
</thead>
</table>                                                                                                                                                                         
    <div class="modal-footer"> 
    <input type="hidden" value="<%= ViewContext.RouteData.Values["controller"] %>" name="locationController" /> 
    <input type="hidden" value="<%= ViewContext.RouteData.Values["action"] %>" name="locationAction" />    
    <a href="#" class="btn btn-primary" onclick="return AccountAlertsInsertUpdate()">Add</a>    
    <a href="#" class="btn btn-primary" onclick="return SetAlerts();">Save Changes</a>
    </div>

1 个答案:

答案 0 :(得分:0)

InputExtensions.Hidden(HtmlHelper, "accountId", ((MediaSuite.Web.UI.Code.CurrentUser)Session["current_user"]).AccountId)