I have ASP.Net MVC3 project with Razor template, and I need to make a reporting tool for summary reports and detailed reports.
I do not know how to create such reports in MVC3. Could anyone give me an example for creating these reports?
There isn't a built-in control for reports, there is however an HTML helper for displaying charts. Please see example here
SSRS reports are not supported by default in MVC 3, therefore you need to use a report viewer control. Article explaning how to do this can be found here
first, i must configure the dataset in my project. because i use storedprocedure, so i must add new table adapter in my dataset.
then i add new item (for the report file) in my project and design the report using report wizard.
after that, for showing the report in my project, i add new web form and in my web form, drag the report viewer and script manager. choose the design view to set up the report.
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" SizeToReportContent="true"
Font-Size="8pt" InteractiveDeviceInfos="(Collection)"
WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
<LocalReport ReportPath="Reports\rptbooking.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="rptBatchClose.RDYGetawayDataSetTableAdapters.DataTable1TableAdapter">
</asp:ObjectDataSource>
</div>
</form>
</body>
this is the simple way to make SSRS report in my MVC3 Project.
Related
I am new to Oracle Apex.I am trying to receive POST data in Oracle Apex page. I want to submit a HTML form and receive that post submission in my Oracle Apex app. searched web but couldn't get suggestions.
In my Oracle database 11g, I have configured Apex 18.1 which is running in 8085 port and created some basic pages.
<!DOCTYPE html>
<html>
<body>
<h2>HTML Forms</h2>
<form action="http://localhost:8085/apex/f?p=106:4:9735956410807:::::" method="post">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
<p>If you click the "Submit" button, the form-data will be sent to Oracle Apex page.".</p>
</body>
</html>
This POST submission will be from external source and Apex app should process this submission.
Thanks in advance.
There are a couple options here:
You could create a webservice using APEX Restful services and sending there. It's probably much safer than exposing you application like you are doing. Worst case scenario you'll have to convert you form post to a json on the backend of the original app, which should be easy pease.
Why not just create a public page with an APEX form and execute a process after the submit happens? You have a tool that generate forms and you are building one from scratch?
*** Having said that, you might want to have the page in a different domain, site, etc... I still think you would be better telling on the other site that the person would be redirected and then sending it to the APEX form
I'm having problems using Ajax.BeginForm() in my simple ASP.NET MVC application. I've searched SO for solution but nothing I found seems to help.
I've created a new project using the default Visual Studio 2015 template. I've changed the Index.cshtml file to:
#{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p>Learn more ยป</p>
</div>
<div class="row">
<div id="ajax-test"></div>
#using (Ajax.BeginForm("Test", new AjaxOptions()
{
UpdateTargetId = "ajax-test",
InsertionMode = InsertionMode.Replace
}))
{
<input type="submit" />
}
</div>
I've added a new action to HomeController:
public ActionResult Test()
{
return PartialView("Test");
}
A new view Home\Test.cshtml:
Hello world
And, crucially, I've added a reference to the required JavaScript files to _Layout.cshtml (moving them to the top of the page doesn't help).
...
#Scripts.Render("~/bundles/jquery")
#Scripts.Render("~/bundles/jqueryval")
#Scripts.Render("~/bundles/bootstrap")
#RenderSection("scripts", required: false)
</body>
</html>
I've verified the jqueryval bundle renders in the debug mode as:
<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>
These entries were already present in web.config file:
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
I would expect that when I press Submit, the div will be populated with 'Hello world'. Instead, the whole page is replaced with 'Hello world' and the browser is redirected to /Home/Test. No errors reported in developer tools.
What element of the puzzle is missing? I know similar questions have been asked on StackOverflow before but the usual answer was to include these JavaScript files, which I did. Above are all the changes I've done to the template project so I can't see what I could break.
I've struggled with it for hours and managed to find the solution 5min after posting on StackOverflow. Typical.
I had to install a NuGet package Microsoft.jQuery.Unobrusive.Ajax, which is not installed by default, and add a reference to jquery.unobtrusive-ajax.js to the page. I thought it has been merged in into jquery.validate.unobtrusive.js or something but no.
I have tried implementing this, but the extension methods are not working when I rewrite them in VB. I am trying to use a corporate master page in my MVC3 application. Right now I have my .Master and my .ascx page. I am confused on how to get it to show in my razor view.
my .ascx page:
<%# control Language="VB" Inherits="System.Web.Mvc.ViewUserControl" %>
<asp:Content ID="Content" ContentPlaceHolderID="ContentArea" runat="server">
<div>
Hello World
</div>
</asp:Content>
When I run it, it gives me this error: Content controls have to be top-level controls in a content page or a nested master page that references a master page.
I use my _ViewStart.vbhtmlto call on the .ascx page.
Trying to hack webforms objects to work with MVC3 is only going to cause you trouble down the road. Redo the file as an MVC3 layout using razor.
Edit: added
Layout File Tutorials:
Making layout pages
Understanding Layout Files
Layouts and Sections
In my Layout page, i have the following links to the validation Javascript files,
<script src="#Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"> </script>
<script src="#Url.Content("~/Scripts/jquery.validate.min.js")"type="text/javascript"> </script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.js")"type="text/javascript"></script>
My entities are decorated with validation attributes like
[Required(ErrorMessage ="Please enter a customer name")]
public string CustomerName { get; set; }
Then in my view i have validation messages specified after the update fields like so
<div class="label-for">#Html.LabelFor(model => model.CustomerName)</div>
<div class="editor">#Html.EditorFor(model => model.CustomerName)</div>
#Html.ValidationMessageFor(model => model.CustomerName)
The validation is working however its not on the client side, the way i understand this is that error messages should be displayed when one of the fields is left blank afer tabbing to another field, is there anything else required to get client side validation working?
IIRC there were some incompatibilities between jquery and jquery.validate versions. You seem to be using an old version of jquery 1.4.4. Try updating with the latest. For example install the ASP.NET MVC 3 Tools Update and create a new ASP.NET MVC project in Visual Studio which will get you the proper versions of the following scripts: jquery, jquery.validate and jquery.validate.unobtrusive.
May be this work: Make sure that in your web.config file, you set "ClientValidationEnabled" to "True"
<appSettings>
<add key="ClientValidationEnabled" value="true"/>
</appSettings>
NOTE: In MVC3 web project, there were two web.config files one under "View" folder another under root web project. make sure that the one in the root does not override the other.
jQuery validation has nothing to do with your validation mechanism. Maybe Microsoft.Ajax.Validation should be the responsible. But to use jquery.validation, you should write code. That's all. It doesn't do anything out of the box.
I have a user control called "Request" that I am able to display outside of a TabContainer on my SharePoint 2010 application page. So the following works:
<UserControl:Request ID="Request1" runat="server" />
<Ajax:TabContainer ID="TabContainer1" runat="server" ScrollBars="None" Enabled="true">
<Ajax:TabPanel ID="TabPanel1" runat="server" HeaderText="Request">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label">Mylabel</asp:Label>
</ContentTemplate>
</Ajax:TabPanel>
</Ajax:TabContainer>
However, if I merely move the UserControl line into the ContentTemplate section, replacing the existing Label control, the page bombs out with a runtime error and "Request failed".
The workaround for me was to COPY, not MOVE, the user control into the ContentTemplate section, then give the copy a different ID and set the original (which I don't need) to visible="false". I have no idea why this works and it looks like a bug to me. If anyone can explain it, please do so...