Click here to Skip to main content
15,899,314 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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();
           });
       });


C#
$(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;
          });
      });

XML
<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>



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
Posted

1 solution

Replace the existing code with this. You need to pop up only the report when the button click $('#DivShowReport').dialog('open');
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900