How to play audio and video in MVC - model-view-controller

I am porting an ASP. NET application to MVC .in one page i need to play audio and video file .
For that i used MediaPlayers.dll in the application.
In asp .net i usd it like shown below
<%# Register Assembly="MediaPlayers" Namespace="MediaPlayers" TagPrefix="cc1" %>
and i accessed this dll using following code
<cc1:MediaPlayer ID="MediaPlayer1" runat="server" Width="250" Height="42" autoStart="True"
MovieWindowSize="0" ShowControls="True" UIMode="full" WindowLessVideo="True"
AllowHideControls="True" AllowHideDisplay="True" Balance="0" ButtonsVisible="True"
DisplayMode="0" EnableContextMenu="True" Enabled="True" Filename="" fullScreen="False"
Invisible="False" Loop="1" Rate="1" ShowDisplay="False" StretchToFit="True" Volume="100">
</cc1:MediaPlayer>
i can access it from code behind using the id Mediaplayer1.
But now in mvc, how i can include this dll in my application and how can i access it from controller?

Razor Views offer their own handling of media players. A description is on the mvc site.

Related

How not to be confined into content area... full size web app on Joomla

I am currently creating an Intranet ERP application that will integrate an already existing corporate Joomla 3.1 based web site.
The extension i made so far only has one default controller php file and everything is made using a JavaScript UI framework. (i.e. jqWidgets) So i am not using model, views, helpers.
The other php files are there to respond to the client side interface AJAX requests.
So i mainly need Joomla for the user authentication and session control features but i dont want it to confine my extensions output to the content area... i need the entire document surface... no menu, no module columns, no nothing !
Can it be done ?
Two ways
component.php in the template will show only the component's output add &tmpl=component to your urls
Make a custom template that only outputs the component
<html>
<head>
<!-- put what scripts stylesheets you need etc//-->
</head>
<body>
<jdoc:include type="component" />
</body>
</html>

What Are the Correct Web.Config Settings for the VS2010 F# Compiler?

I've got an ASPX page like this:
<%# Page Language="F#" %>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<%-- Try to output "This is a Test" 10 times --%>
<% for i = 1 To 10 do %>
<p>This is a test</p>
</body>
</html>
and a web.config that looks like this:
<?xml version="1.0"?>
<configuration>
<system.codedom>
<compilers>
<compiler language="F#;f#;fs;fsharp"
extension=".fs"
warningLevel="4"
type="Microsoft.FSharp.Compiler.CodeDom.FSharpAspNetCodeProvider,
FSharp.Compiler.CodeDom, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=a19089b1c74d0809">
<providerOption name="CompilerVersion" value="v4.0" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
</configuration>
When I run my VS2010 WebApp, I get an error like this:
"The CodeDom provider type "Microsoft.FSharp.Compiler.CodeDom.FSharpAspNetCodeProvider,
FSharp.Compiler.CodeDom, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=a19089b1c74d0809" could not be located."
I've tried the settings mentioned by manojlds here, but they don't seem to be working for me either. I think it is because my copy of VS2010 Pro has a newer version of the F# compiler, but I don't know how to tell for sure.
Can someone help me understand the correct version settings that I should use in a VS2010 web.config for the "compiler" and "providerOption" elements?
I have not tried this, but your configuration file looks correct to me - can you check what eversion of the FSharp.Compiler.CodeDom assembly is installed in your GAC (by looking at C:\windows\assembly)?
However, at the moment, I would not really recommend using F# for writing of the ASPX part of a web page. It works, but you won't get as smooth experience when mixing C# with ASPX or using the Razor templating engine (for ASP.NET MVC).
I think the best way to create server-side ASP.NET web applications in F# is to use F# for the code behind (in traditional WebForms) or for the model and controller parts (in MVC). There is also a number of templates and tutorials that describe how to do this:
Tutorial: Creating a Web Project in F# Using an Online Template
and templates for ASP.NET MVC 4 and older ASP.NET MVC 3
You might also want to check out the Web Stacks page on fsharp.org

Using webform master page in razor view

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

ASP.Net MVC 3 Razor Create Report

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.

Mixing Razor Views and Web Forms Master Pages

I'm attempting to do what Scott Hanselman describes below:
http://www.hanselman.com/blog/MixingRazorViewsAndWebFormsMasterPagesWithASPNETMVC3.aspx
I have a Web Form user control with code behind that is called from the Web Form and Razor Master Pages that is not working in the Razor layout:
<div id="navtop">
#{ Html.RenderPartial("~/Controls/MasterPageMenu.ascx"); }
</div>
The user control contains the following:
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="MasterPageMenu.ascx.cs" Inherits="Controls.MasterPageMenu" %>
I get the error:
The view at '~/Controls/MasterPageMenu.ascx' must derive from ViewPage, ViewPage, ViewUserControl, or ViewUserControl.
What have I missed in getting this to work in the Razor view world?
This should work, just make sure that your partial derives from ViewUserControl:
<%# Control
Language="C#"
Inherits="System.Web.Mvc.ViewUserControl"
%>
Remember that using server side controls in ASP.NET MVC is not something that's recommended even with the WebForms view engine and not something that you should even be attempting to do. In ASP.NET MVC you have layouts (master pages if you use WebForms view engine), views and partials. That's all. User controls belong to classic WebForms, not to ASP.NET MVC.

Resources