在按钮单击事件对话框下渲染div, [英] Render div under dialog box on button click event,

查看:120
本文介绍了在按钮单击事件对话框下渲染div,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我一直在mvc jquery的对话框中工作。

我面临的问题是



当我点击弹出的链接对话框时,我在对话框中有一个按钮,

我想生成关于此的报告按钮点击。



我为此完成了以下代码。



Hi Friends,

I have been work around the dialog in mvc jquery.
The problem which i am facing that is

When i click the link dialog pop up,and i have a button in the dialog,
and i want to genrate the report on this button click.

I have done the following code for this.

public ActionResult ShowSummaryReport(string FromDate, string ToDate, string UserName)
        {
            testentity rexdb = new testentity ();
            List<AdminInfo> Countlist = new List<AdminInfo>();
            var listforUser=(from n in rexdb.test.AsEnumerable()
                            where n.LoginId == UserName
                            select n).ToList();

            ViewData["SummaryReport"] = listforUser;
            return View(listforUser);
        }




function showDataInner() {
           $.ajax({
               url: ''/LoginPage/ShowSummaryReport'',
               type: ''POST'',
               data: {
                FromDate: $(''#txtFromDateRe'').val(),
                ToDate: $(''#txtToDateRe'').val(),
                UserName: $(''#REGLoginid'').val()
                },
               success: function (data) {
                   $("#DivShowReport").empty();
                   $("#DivShowReport").html(data);
                    $(''#DivShowReport'').load(data);
               }
           });

       }
       $(document).ready(function () {
           $(''#BtnInShowReport'').click(function (e) {
               showDataInner();
           });
       });







$(function () {
          $('#dialog').dialog({
              autoOpen: false,
              width: 600,
              buttons: {
                  "Ok": function () { $(this).dialog("close"); },
                  "Cancel": function () { $(this).dialog("close"); }
              }
          });
          $('#datashoe').click(function (e) {
              $('#dialog').dialog('open');
              return false;
          });
      });




<div id="dialog" title="User data">
       <table>
           <tr>
               <td class="label1">
                   From Date(MM/DD/YYYY)
               </td>
               <td align="center">
                   <%: Html.TextBox("txtFromDateRe","",new { @class = "textboxcalc" })%>
               </td>
           </tr>
           <tr>
               <td class="label1">
                   To Date(MM/DD/YYYY)
               </td>
               <td align="center">
                   <%: Html.TextBox("txtToDateRe","",new { @class = "textboxcalc" })%>
               </td>
           </tr>
           <tr>
               <td class="label1" style="padding-top: 10px">
                   <input id="BtnInShowReport" type="submit" name="BtnInShowReport" value="" class="showReport" />
               </td>
           </tr>
           <tr>
               <td>
                   <div id="DivShowReport">
                       <table>
                           <tr>
                               <td>
                                   <%Html.RenderPartial("testview", ViewData["SummaryReport"]);%>
                               </td>
                           </tr>
                       </table>
                   </div>
               </td>
           </tr>
       </table>
   </div>







如何使用我从动作结果ShowSummaryReport中选取的数据渲染DivShowReport。单击show report按钮时弹出窗口应该仍然打开。



请帮助我



谢谢




How to render the DivShowReport with data which i am picking from the action result ShowSummaryReport.and the pop up should be still open when click on the show report button.

Please help me

Thanks

推荐答案

.ajax({
url: ''/ LoginPage / ShowSummaryReport'',
类型:''POST'',
数据:{
FromDate:
.ajax({ url: ''/LoginPage/ShowSummaryReport'', type: ''POST'', data: { FromDate:


(''#txtFromDateRe '')。val(),
ToDate:
(''#txtFromDateRe'').val(), ToDate:


(''#txtToDateRe'')。val(),
UserName:
(''#txtToDateRe'').val(), UserName:


这篇关于在按钮单击事件对话框下渲染div,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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