Migrate an ASP.NET MVC 2 project to MVC 3 Razor viewhttp://forums.asp.net/t/1600074.aspx/1?Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewFri, 08 Oct 2010 07:29:30 -040016000744068037http://forums.asp.net/p/1600074/4068037.aspx/1?Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewMigrate an ASP.NET MVC 2 project to MVC 3 Razor view <p>Hi all,</p> <p>I have an application which has been built in MVC 2.0. I need to upgrade it to MVC 3.0 and that too by using Razor CSHTML engine.</p> <p>All the information which I got on the net was for MVC 3.0 Webform engine but nothing much for migrating to Razor.</p> <p>I would be very grateful if somebody shows me the steps or sample walkthrough for the purpose of this migration.</p> <p>Any help would be greatly appreciated.</p> <p>Thanks and regards,</p> <p>Tanay.</p> 2010-09-08T13:40:09-04:004068119http://forums.asp.net/p/1600074/4068119.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p>Check,</p> <p><a href="http://weblogs.asp.net/imranbaloch/archive/2010/09/01/another-way-to-get-start-asp-net-mvc-3-preview-1.aspx">http://weblogs.asp.net/imranbaloch/archive/2010/09/01/another-way-to-get-start-asp-net-mvc-3-preview-1.aspx</a></p> <p><a href="http://weblogs.asp.net/leftslipper/archive/2010/07/28/migrating-asp-net-mvc-2-applications-to-asp-net-mvc-3-preview-1.aspx">http://weblogs.asp.net/leftslipper/archive/2010/07/28/migrating-asp-net-mvc-2-applications-to-asp-net-mvc-3-preview-1.aspx</a></p> <p><b>Update</b>: Marcin has now done the job for you</p> <p><a href="http://blogs.msdn.com/b/marcinon/archive/2011/01/13/mvc-3-project-upgrade-tool.aspx">http://blogs.msdn.com/b/marcinon/archive/2011/01/13/mvc-3-project-upgrade-tool.aspx</a></p> 2010-09-08T14:27:32-04:004068387http://forums.asp.net/p/1600074/4068387.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p>Hi,</p> <p>1. I have already seen the second URL.</p> <p>When I run the converter, my project gets converted successfully.</p> <p>But when I try to run the site, I get the following error:</p> <p><span style="font-weight:bold">Compiler Error Message:&nbsp;</span>CS1061: 'object' does not contain a definition for 'SetDate' and no extension method 'SetDate' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)</p> <p>The same works fine in MVC 2.</p> <p><br> </p> <p>2. I took a look at the first URL now.</p> <p>I do not have an OS problem-- It is Windows Vista Home Premium and VS 2010 Professional.</p> <p>I created a new empty ASP.NET MVC 3 project using Razor View engine &amp; its working fine.</p> <p>My problem is that I have an existing project in which there are more than a couple of views and I need to convert these views from MVC 2 to ASP.NET MVC 3 Razor View engine.</p> <p>I am not finding any doc. on the same and I don't know how to proceed (i.e. should I copy the Controllers &amp; Models and then generate the views or should I copy the views from MVC 2 to 3, or what else should be done, I have absolutely no idea!).</p> <p>Thanks for the reply. Please guide me if possible.<br> </p> <p>Tanay.<br> </p> 2010-09-08T17:25:04-04:004068443http://forums.asp.net/p/1600074/4068443.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> 1. I have already seen the second URL.</blockquote> <p></p> <p>Is you tried first. This simply add new MVC 3 components into your MVC 2 application.</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> My problem is that I have an existing project in which there are more than a couple of views and I need to convert these views from MVC 2 to ASP.NET MVC 3 Razor View engine.</blockquote> <p></p> <p>Note that the MVC 3 supports&nbsp; both Razor and WebForm ViewEngine and the above convertor will not convert your WebForm view into razor view. You need to manually create one.<br> </p> 2010-09-08T18:16:41-04:004070257http://forums.asp.net/p/1600074/4070257.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> <p></p> <p><span style="font-weight:bold">Compiler Error Message:&nbsp;</span>CS1061: 'object' does not contain a definition for 'SetDate' and no extension method 'SetDate' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)</p> <p></p> </blockquote> This compiler error is because of a bug in MVC 3 Preview 1, which shows on any page where there are any directives AFTER the &lt;% @Page %&gt; directive. As a temporary work-around, you can move any other directives above the &lt;% @Page %&gt; directive, or convert the views to Razor (which doesn't have this bug), or wait for the new preview release of MVC. <p></p> 2010-09-09T17:49:45-04:004074771http://forums.asp.net/p/1600074/4074771.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p><font size="2" face="Consolas"><font size="2" face="Consolas"></p> <p>Hi,</p> <p>I am getting an error for a missing brace when I converted the following code to Razor view. However no brace is missing.</p> <p>@foreach (HSDisplayBoard.Models.CreateScheduleModel r in Model.ScheduleList) { </p> <p>@if (r.Status == 1){</p> <p>&lt;tr class =&quot;preop&quot; &gt;</p> <p>}</p> <p>@if (r.Status == 2){</p> <p>&lt;tr class =&quot;or&quot; &gt;</p> <p>}</p> <p>........</p> <p>}</p> <p>Please let me know if this is the correct way for writing nested loops using Razor view. Or is something else to be done?</p> <p>Any guidance would be greatly appreciated.</p> <p>Tanay.</p> </font></font> <p></p> 2010-09-13T06:21:04-04:004074803http://forums.asp.net/p/1600074/4074803.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p>@foreach (HSDisplayBoard.Models.CreateScheduleModel r in Model.ScheduleList) {<br> <br> if (r.Status == 1){<br> <br> &lt;tr class =&quot;preop&quot; &gt;&lt;/tr&gt;<br> <br> }<br> <br> if (r.Status == 2){<br> <br> &lt;tr class =&quot;preop&quot; &gt;&lt;/tr&gt;<br> <br> }<br> <br> <br> <br> }</p> 2010-09-13T06:35:41-04:004075474http://forums.asp.net/p/1600074/4075474.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p>Hi, removing the @ from the inner ifs worked fine.</p> <p>I wanted to confirm if the following is proper:</p> <p>1. @import Namespace = &quot;N1&quot; becomes @using N1.</p> <p>2. @ResolveUrl(....) becomes @Url.Content(....).</p> <p>3. @GetLocalResourceObject(....) becomes @Html.Resource(....).</p> <p>Thanks for your help!</p> 2010-09-13T13:11:43-04:004075623http://forums.asp.net/p/1600074/4075623.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> 1. @import Namespace = &quot;N1&quot; becomes @using N1.</blockquote> <p></p> <p>This will work. For global namespace see CodeGeneratorSettings.AddGlobalImport</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> 2. @ResolveUrl(....) becomes @Url.Content(....).</blockquote> <p></p> <p>This will work also and ResolveUrl is not present in Razor View page, </p> <p>You can also use VirtualPathUtility.ToAbsolute.</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> 3. @GetLocalResourceObject(....) becomes @Html.Resource(....).</blockquote> <p></p> <p>I don't see Html.Resource extension in MVC<br> </p> <p>Use @<b>ViewContext.HttpContext</b>.GetGlobalResourceObject(&quot;Account&quot;,&quot;USERNAME&quot;)</p> <p><br> </p> 2010-09-13T14:43:46-04:004076672http://forums.asp.net/p/1600074/4076672.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p>Hi, I'm a bit confused about the GetGlobalResourceObject bit of it. For eg., how would the following look like? </p> <p>1 @GetLocalResourceObject(&quot;displHeader&quot;).ToString() </p> <p>2 @Html.Label(GetLocalResourceObject(&quot;_lczScheduleDate.Text&quot;).ToString())</p> 2010-09-14T07:02:35-04:004077808http://forums.asp.net/p/1600074/4077808.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> <br> <br> Hi, I'm a bit confused about the GetGlobalResourceObject bit of it. For eg., how would the following look like?<br> <br> 1 @GetLocalResourceObject(&quot;displHeader&quot;).ToString()<br> <br> 2 @Html.Label(GetLocalResourceObject(&quot;_lczScheduleDate.Text&quot;).ToString())<br> <br> </blockquote> <br> <br> @<b>ViewContext.HttpContext</b>.<b>GetGlobalResourceObject</b>(&quot;Account&quot;,&quot;displHeader&quot;)<br> <br> @Html.Label(<b>ViewContext.HttpContext.GetLocalResourceObject</b>(&quot;~/Views/Home/Index.cshtml&quot;,&quot;_lczScheduleDate&quot;).ToString())<br> <br> Please note that you must have Index.cshtml.resx, inside /Views/Home/App_LocalResources folder,<br> <br> For global resource you can also use<br> <br> @YourNameSpace.Account.displHeader<br> <br> You can check your namespace by openining Account1.Designer.cs file, Also replace internal to public in this file. <p></p> 2010-09-14T17:14:19-04:004081961http://forums.asp.net/p/1600074/4081961.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p>Hi, I would please like to know how the following Javascript code can be converted:</p> <p>1</p> <p><font size="2" face="Consolas"><font size="2" face="Consolas"></p> <p>function DisplayInsideOT() {</p> <p>var hndl = window.open('@Request.ApplicationPath.Length&lt;=1 ? string.Empty : Request.ApplicationPath /DisplayBoard/DisplayInsideOT', &quot;_self&quot;, &quot;&quot;, true);</p> <p>}</p> <p>2</p> <p></p> <p><font size="2" face="Consolas"><font size="2" face="Consolas"></p> <p>@if (Model.ScheduledDate == DateTime.MinValue)</p> <p>{ </p> <p>&#36;('#txtScheduledDate').val('@String.Format(&quot;{0:00}&quot;,DateTime.Now.Day) &#43; &quot;/&quot; &#43; String.Format(&quot;{0:00}&quot;,DateTime.Now.Month) &#43; &quot;/&quot; &#43; DateTime.Now.Year.ToString()');</p> <p>}</p> <p>else</p> <p>{</p> <p>&#36;('#txtScheduledDate').val('@String.Format(&quot;{0:00}&quot;,Model.ScheduledDate.Day) &#43; &quot;/&quot; &#43; String.Format(&quot;{0:00}&quot;,Model.ScheduledDate.Month) &#43; &quot;/&quot; &#43; Model.ScheduledDate.Year.ToString()');</p> <p>}</p> </font></font> <p></p> </font></font> 2010-09-16T09:47:28-04:004082828http://forums.asp.net/p/1600074/4082828.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p>function DisplayInsideOT() {<br> <br> var hndl = window.open('@(Request.ApplicationPath.Length&lt;=1 ? string.Empty : Request.ApplicationPath &#43; &quot;/DisplayBoard/DisplayInsideOT&quot;)', &quot;_self&quot;, &quot;&quot;, true);<br> <br> }<br> <br> <br> <br> @if (Model.ScheduledDate == DateTime.MinValue)<br> <br> {<br> &lt;text&gt;<br> &#36;('#txtScheduledDate').val('@String.Format(&quot;{0:00}&quot;,DateTime.Now.Day) &#43; &quot;/&quot; &#43; String.Format(&quot;{0:00}&quot;,DateTime.Now.Month) &#43; &quot;/&quot; &#43; DateTime.Now.Year.ToString())');<br> &lt;/text&gt;<br> }<br> <br> else<br> <br> {<br> &lt;text&gt;<br> &#36;('#txtScheduledDate').val('@(String.Format(&quot;{0:00}&quot;,Model.ScheduledDate.Day) &#43; &quot;/&quot; &#43; String.Format(&quot;{0:00}&quot;,Model.ScheduledDate.Month) &#43; &quot;/&quot; &#43; Model.ScheduledDate.Year.ToString())');<br> &lt;/text&gt;<br> }</p> <p><br> </p> 2010-09-16T18:02:55-04:004083933http://forums.asp.net/p/1600074/4083933.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p>Hi, I am unable to get the page when I click on link in first case.</p> <p>Could it be due to an error in converting the following:</p> <p>&lt;tr&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td align=&quot;center&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;img src='@Url.Content(&quot;~/Content/Images/blank.gif&quot;) ' align=&quot;middle&quot; height=&quot;2px&quot; /&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr style=&quot;border-style: none&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td valign=&quot;top&quot; style=&quot;border-style: none&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;a href=&quot;#&quot; onclick=&quot;javascript:DisplayInsideOT();&quot; title=&quot;Open InsideOT Page&quot;&gt;Inside OT Info. &gt;&gt;&lt;/a&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;</p> <p>Also on another page I am getting errors&nbsp;for following code:</p> <p>1. @Html.EnableClientValidation();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @Html.ValidationSummary()<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;<br> &nbsp;&nbsp;&nbsp; @Html.BeginForm() &lt;table&gt; ..... &lt;/table&gt;</p> <p>2. &lt;td&gt;@Html.DropDownListFor(model =&gt; model.Status, new SelectList((IEnumerable) <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (from HSDisplayBoard.Models.Utility.Status status in <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Enum.GetValues(typeof(HSDisplayBoard.Models.Utility.Status)) where (Int32)status &gt;= (Int32)Model.Status<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select new { ID = (Int32)status, Name = status.ToString() }), &quot;ID&quot;, &quot;Name&quot;))<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt;</p> <p>Please advise, Thanks.</p> <p>&nbsp;</p> 2010-09-17T09:27:13-04:004084711http://forums.asp.net/p/1600074/4084711.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> &lt;tr&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td align=&quot;center&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;img src='@Url.Content(&quot;~/Content/Images/blank.gif&quot;) ' align=&quot;middle&quot; height=&quot;2px&quot; /&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr style=&quot;border-style: none&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td valign=&quot;top&quot; style=&quot;border-style: none&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;a href=&quot;#&quot; onclick=&quot;javascript:DisplayInsideOT();&quot; title=&quot;Open InsideOT Page&quot;&gt;Inside OT Info. &gt;&gt;&lt;/a&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;</blockquote> <p></p> <p>I think you are missing this function</p> <p>function DisplayInsideOT()<br> &nbsp;&nbsp;&nbsp; {<br> .....................<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> 2. &lt;td&gt;@Html.DropDownListFor(model =&gt; model.Status, new SelectList((IEnumerable) <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (from HSDisplayBoard.Models.Utility.Status status in <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Enum.GetValues(typeof(HSDisplayBoard.Models.Utility.Status)) where (Int32)status &gt;= (Int32)Model.Status<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select new { ID = (Int32)status, Name = status.ToString() }), &quot;ID&quot;, &quot;Name&quot;))<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt;</blockquote> <br> <p></p> <p>@{<br> var a=from DisableClientSideValidation.Controllers.Status status in<br> &nbsp;&nbsp;&nbsp; Enum.GetValues(typeof(DisableClientSideValidation.Controllers.Status)) where (Int32)status &gt;= (Int32)Model.Status<br> &nbsp;&nbsp; &nbsp;select new { ID = (Int32)status, Name = status.ToString() };<br> }<br> @Html.DropDownListFor(model =&gt; model.Status,new SelectList(a.ToList()) , &quot;ID&quot;, &quot;Name&quot;)</p> 2010-09-17T17:22:22-04:004085386http://forums.asp.net/p/1600074/4085386.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p>1. Hi, I am not missing the function. I am using the input which you provided as under:<br> <br> function DisplayInsideOT() {<br> <br> var hndl = window.open('@(Request.ApplicationPath.Length&lt;=1 ? string.Empty : Request.ApplicationPath &#43; &quot;/DisplayBoard/DisplayInsideOT&quot;)', &quot;_self&quot;, &quot;&quot;, true);<br> <br> }<br> <br> 2. Also I am unable to set client side validation when I do the following:<br> <br> @Html.EnableClientValidation();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @Html.ValidationSummary()<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;<br> &nbsp;&nbsp;&nbsp; @Html.BeginForm()<br> &nbsp; &lt;table&gt; ..... &lt;/table&gt;<br> <br> Please advise how this can be done.</p> 2010-09-18T09:11:00-04:004085794http://forums.asp.net/p/1600074/4085794.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> <br> function DisplayInsideOT() {<br> <br> var hndl = window.open('@(Request.ApplicationPath.Length&lt;=1 ? string.Empty : Request.ApplicationPath &#43; &quot;/DisplayBoard/DisplayInsideOT&quot;)', &quot;_self&quot;, &quot;&quot;, true);<br> <br> }<br> </blockquote> <p></p> <p>I had checked this is working.</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> Also I am unable to set client side validation when I do the following:<br> <br> @Html.EnableClientValidation();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @Html.ValidationSummary()<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;<br> &nbsp;&nbsp;&nbsp; @Html.BeginForm()<br> &nbsp; &lt;table&gt; ..... &lt;/table&gt;<br> </blockquote> <p></p> <p>Also need to add scripts files.<br> </p> 2010-09-18T17:50:45-04:004088016http://forums.asp.net/p/1600074/4088016.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p><font size="2" face="Consolas"><font size="2" face="Consolas"></p> <p>Is this the right way to add a script file?</p> <p>&lt;script src=&quot;@Url.Content(&quot;~/Scripts/jquery.tablePagination.0.2.min.js&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</p> </font></font> <p></p> 2010-09-20T05:58:41-04:004088119http://forums.asp.net/p/1600074/4088119.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p></p> <blockquote><span class="icon-blockquote"></span> <h4>tanay_s</h4> <p></p> <p><font size="2" face="Consolas"><font size="2" face="Consolas"></font></font></p> <p><font size="2" face="Consolas"><font size="2" face="Consolas"></font></font></p> <p><font size="2" face="Consolas"><font size="2" face="Consolas"></p> <p>Is this the right way to add a script file?</p> <p>&lt;script src=&quot;@Url.Content(&quot;~/Scripts/jquery.tablePagination.0.2.min.js&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</p> </font></font> <p></p> <p></p> <p></p> </blockquote> Yes. <p></p> 2010-09-20T07:08:53-04:004088347http://forums.asp.net/p/1600074/4088347.aspx/1?Re+Migrate+an+ASP+NET+MVC+2+project+to+MVC+3+Razor+viewRe: Migrate an ASP.NET MVC 2 project to MVC 3 Razor view <p>Hi,&nbsp;at the end of the above file there is a line&nbsp;as:</p> <p>(jquery);</p> <p>This gives me a Microsoft Jscript runtime error saying that JQuery is not defined.</p> <p>&nbsp;I have included the following files which were part of my MVC 2 project:</p> <p>jquery-1.3.2-vsdoc.js, jquery-1.3.2.js, jquery-1.3.2-min.js</p> <p>jquery-1.4.2-vsdoc.js, jquery-1.4.2.js, jquery-1.4.2-min.js</p> <p>Please let me know what is causing the problem.</p> 2010-09-20T09:24:28-04:00