.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

MVC 3.0 preview 1, Html.RenderAction Problem

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :ASP.Net

Hi all,

I'm trying to use Html.RenderAction with MVC 3.0 preview 1 and i'm getting an error. i have the following controller:

	public class HelpController : Controller
public ActionResult Detail(int id)
ViewModel.Title = "Help Title! " + id.ToString();
ViewModel.Content = "Help Content!" + id.ToString();

return View();

and in another controller, i'm trying to do:

@Html.RenderAction("Detail", "Help", new { id = 3 });

but i keep getting:
CS1502: The best overloaded method match for 'Microsoft.WebPages.WebPageUltimateBase.Write(Microso

View Complete Post

More Related Resource Links

Embed Youtube inside Ajax Html Editor- problem



When inserting a simple embed of youtube inside the ajax editor, on firefox and chrome problems occur. On the other hand on internet explorer 8 everything works fine. I found this solution http://www.nopcommerce.com/boards/t/4228/bug-in-ajax-html-editor.aspx . 

My question is where do I find the DesignPanel.pre.js ?


Roderick Vella

problem when converting html to pdf using ItextSharp


 hi all

i have using itextsharp to convert html to pdf and its worked very good in english letters (A-Z) but when i trying to do it with arabic letters i have got empty pdf , can any one help me? what i should do ?

System.Net.Mail HTML Template Problem


What do I need here ?????? To make this work??

Dim MassMail As New MailMessage()

        Dim Template As ??????????????

        MassMail.To.Add(New MailAddress(TextBox_massemailto.Text))
        MassMail.From = New MailAddress("You@me.com")

        ' MassMail.CC.Add()
        MassMail.Subject = TextBox_massemailsubject.Text
        MassMail.Body = TextBox_massemailBody.Text
        ' MassMail.Body = Template.BodyFileName = "EmailTemplates/BusinessAdBrochure.htm"
        MassMail.Priority = MailPriority.High

        Dim smtpclient As New SmtpClient("relay-hosting.secureserver.net")
        smtpclient.Credentials = New System.Net.NetworkCredential(""You@me.com"", "pasword")
        smtpclient.Port = 25
        smtpclient.EnableSsl = False

POST from html form viewstate problem

<p> Hi all, I have a website where people need to pay for a specific download (.pdf file). After they payed they get the download(A). My payment-provider can do a HTML-Postback to the site i want, for each succesfull payment. So the idea is that if someone payed, they do a postback to my server with a couple of parameters, so i can know that that specific email address has payed, and they get the download. I tested localy with a .html file on my desktop to postback a set of parameters to my local asp.net website. But in ONLY works if i include the __VIEWSTATE in my html file. And i cant get rid of the viewstate in my HTML of the aspx page. >test.html: <html><head></head><body> <h1>Dit is een test</h1> <form id="form1" action="http://localhost:25659/WebForm1.aspx" method="POST"> <input id="Button1" type="submit" value="submit!"/> 'IT ONLY WORKS IF I INCLUDE THE NEXT LINE: <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMjA0OTM4MTAwNGRk" /> </form></body></html> Has anybody an idea to acomplish my goal? Maybe i can get some info about the postback in my global.asax? or create a HttpHandler for .html files? Anyone?   Thanks in advance, Vincent   </p>

Html editor word wrap problem

I created an html editor which uses an iframe for designing. The iframe doesnt wraps the text within it.... but the text keeps on extending in the same row towards the right. i tried setting scrolling='no' but it didnt work... tried word-wrap:break-word but thats also of no use........ please help! 

urlrewritingnet problem with html

Hi All, I have set up url rewriting in my web.config with regex rules and it works correct for all html files. Problem: When I have a html file that is not a rule, there is an error. How can I keep using not rewrited html files?   So.. I only want to rewrite if the file does not exist. < urlrewritingnet rewriteOnlyVirtualUrls="true" does not seem to work Thanks  

CompilationMode problem in ASP.NET MVC 3 Preview 1


This is for fellow programmers who are using ASP.NET MVC 3 Preview 1 - keep informed.

Yesterday, I was experimenting with ASP.NET MVC 3 Preview 1 and came across a situation, where ASP.NET build manager throws an exception that it could not create the requested view. It does not say - WHY!

This problem does not occur in ASP.NET MVC 2.0 & ASP.NET 4.0 combination. Logically, the GetCompiledType method is doing what it is intended to do - return the compiled type of a page if it is really a compiled/compilable type. But there is some fault in the logic in the upper levels - where the returned result is used to create the view instance. It should also be able to create a non-compiled view - as in the ASP.NET MVC 2.

Details on http://blogs.callosmart.com/2010/09/28/compilationmode-problem-in-asp-net-mvc-3-preview-1/

Somebody from the MVC 3 team can comment on this problem.

Problem displaying a view correctly in MVC app using HTML.TextBoxFor() with VB



I have a test app with a form view.

I cannot get the view to display correctly instead of displaying a series to text boxes it displays quoted html.

I suspect that my problem is related to my VB syntax for my Linq

The C# equivilant works but my shop uses VB so I must convert the code.

Here is the code from the view:

      <% Using (Html.BeginForm)%>
          <p>Your name: <%: Html.TextBoxFor(Function(m) m.Name).ToString%></p>
          <p>Your email: <%: Html.TextBoxFor(Function(m) m.Email).ToString%></p>
          <p>Your phone: <%: Html.TextBoxFor(Function(m) m.Phone).ToString%></p>
          <p>Will you attend? <br />
          <%  Dim slist As New Generic.List(Of SelectListItem)
          slist.Add(New SelectListItem With {.Text = "Yes", .Value = Boolean.TrueString})
          slist.Add(New SelectListItem With {.Text = "No", .Value = Boolean.FalseString})
       <%: Html.DropDownListFor(Function(m) m.WillAttend, slist, "Choose an option")%>
       <input type="submit" value="Submit RSVP" />
       <% End Using%>

RenderAction with Lambda Expression in MVC 3.0 preview 1


Hi all, i have the following, which works:

@{Html.RenderAction("Detail", "Help", new { pageName = "press" });}

But instead i'd like to use a lambda expression to get away from the string bits. I tried using the following (which is the nearest approximation i could figure based on my limited knowledge of the engine):

@{Html.RenderAction<HelpController>(x => x.Detail("press"));}

But i get the following error:

The non-generic method 'System.Web.Mvc.Html.ChildActionExtensions.RenderAction(System.Web.Mvc.HtmlHelper, string, string, System.Web.Routing.RouteValueDictionary)' cannot be used with type arguments

However, i'm reading in the Apress MVC 2.0 book that it is in fact declared as a method that takes type arguments. Am i missing an assembly reference, or has it not been included in the MVC 3.0 Preview 1 build?

Problem deploying custom report item. Items shows in preview screen in VS, but not in server deploye


I have developed a custom report item that works fine in design and preview mode while in Visual Studio. I cannot get it to show up on my deployed reports. Here's what I have done so far:

1. Deployed the report using Visual Studio

2. updated the rsreportserver.config file with the following entry:

      <ReportItem Name="PedigreeChart" Type="Uabr.Rap.PedigreeChart.PedigreeChartRenderer, Uabr.Rap.PedigreeChart" />

3. Updated the rssrvpolicy.config file with the following entry.

                    Description="This code group grants Uabr.Rap.PedigreeChart.dll FUllTrust permission. ">
                                Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin\Uabr.Rap.PedigreeChart.dll" />

I've also tried using the StrongNameMembershipCondition

Razor View Engine problem in Preview corrected in Beta?



On my projects I am using Razor View engine and I need to define custom Partial folders:

      // Define default view engine
      ViewEngines.Engines.Add(new CshtmlViewEngine());
      ViewEngines.Engines.Add(new WebFormViewEngine());

      // Define Razor view engine
      CshtmlViewEngine razor = (CshtmlViewEngine)ViewEngines.Engines[0];

      // Register partial views folders                
      razor.PartialViewLocationFormats = razor.PartialViewLocationFormats.Concat(new String[] { "~/Views/Partial/{0}.cshtml" }).ToArray();
      razor.AreaPartialViewLocationFormats = razor.AreaPartialViewLocationFormats.Concat(new String[] { "~/Areas/{1}/Views/Partial/{0}.cshtml" }).ToArray();

I had this because there was a problem in MVC 3 Preview. Was it corrected?

How should I register the Partial Views in MVC 3 Beta?

Thank You,


Problem with security on ISS?, why can i write HTML file but not XML files


hi guys

I have a web app the manages articles, users can generate articles which we store in the database and also in a folder inside the application in html.  We also have the ability to generate real time alerts, to targetted audiences but the list of audiences was cached from an sql query on the web server and at times, the cache was cleared by the server. so i wrote an http module, and the module now runs the query using a timer, and this then wrties the audiences to an xml file within a folder in the same application (same as my html files)

Now the weird thing is im getting the system.io unauthorised access exception, when i try to delete and overwrite the xml file.  Yet this doesnt happen when i write the html files.

Now although my users do login, there credentials are maintained via an sql database table, not windows security or the asp.net security model. 

Ive checked the folder that we publish our applications up to (its a mapped folder like a virtual directory), and i cannot see the network service or asp.net machine accounts usually used in iis5 or 6.  But i dont have the ability to change this anyway. 

Why would the html file write fine, and the xml file throw this error. 

I also changed my code to used HttpRuntime.AppDom

html report printing problem


i have a 6 page long html report which i want to print, printing behaviour is different between IE and FF, i want to print ony certain number of lines per page, how do i acomplist this task without crystall report or any other propritery tool,

Note: Data of the report is dynamic.

below is the html of my report

        <table cellpadding=0 cellspacing=0 border=0 width=800px>
<img src="images/Header_FS.jpg" width="800px" />

<table cellpadding="0" cellspacing="0" border="0" width="620px">

<td align="center" style="height:40px" valign="middle">
<td align="center">

Preview problem in SSIS

Good Day,

A small doubt...Whenever i,am assigning  Source to the Excel Source, in the "Excel Source Editor wizard" there is "Connection Manager",in this we can assign our source,after assigning, there is a Drop Down button which name is "Name of the Excel sheet", when we click that button there is always two excel sheet names will be there as like sometimes Scenario1)" Excel_Destination, Excel_Destination$" sometimes Scenario2) "Excel sheet name","Excel sheet name$" and sometimes Scenario3)"Data", "Data$".I don't know what is the reason.If there is Scenario1...when we click"preview", it shows error. If there is Scenario2...when we click "preview", it shows only column headers.If there is Scenario3...when we click "Preview", it Shows perfect, i mean, the Excel sheet which i selected.Can you please guys tell me about this issue.

Kind Regards

Awesome HTML minifying function but causes problem at Google Adsense ads - Very Important !


function works perfectly. everything works without any problem and source code becomes single line. but problem is about adsense ads. it is getting messed at screen.


ads are displayed but their locations are not correct. can anybody help me i appricate that alot


thank you


    protected override void Render(HtmlTextWriter writer)
        if (this.Request.Headers["X-MicrosoftAjax"] != "Delta=true")
            System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"<script[^>]*>[\w|\t|\r|\W]*?</script>");
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            System.IO.StringWriter sw = new System.IO.StringWriter(sb);
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            string html = sb.ToString();
            System.Text.RegularExpressions.MatchCollection mymatch = reg.Matches(html);
            html = reg.Replace(html, string.Empty);
            reg = new System.Text.RegularExpressions.Regex(@"(?<=[^])\t{2,}|(?<=[>])\s{2,}(?=[<])|(?<=[>])\s{2,11}(?=[<])|(?=[\n])\s{2,}|(?=[\r])\s{2,}");
            html = reg.Replace(html, string.Empty);
            reg = new System.Text.RegularExpressions

MVC3 Beta @Html.AntiForgeryToken() problem



I am getting strange error when trying to use @Html.AntiForgeryToken() in my views.

The error is:

[ArgumentNullException: Buffer cannot be null.
Parameter name: buffer]
   System.IO.MemoryStream..ctor(Byte[] buffer, Boolean writable) +9638183
   System.IO.MemoryStream..ctor(Byte[] buffer) +6
   System.Web.Mvc.AntiForgeryDataSerializer.Deserialize(String serializedToken) +97

[HttpAntiForgeryException (0x80004005): A required anti-forgery token was not supplied or was invalid.]
   System.Web.Mvc.AntiForgeryDataSerializer.Deserialize(String serializedToken) +397
   System.Web.Mvc.HtmlHelper.GetAntiForgeryTokenAndSetCookie(String salt, String domain, String path) +160
   System.Web.Mvc.HtmlHelper.AntiForgeryToken(String salt, String domain, String path) +16
   System.Web.Mvc.HtmlHelper.AntiForgeryToken() +10

Am I doing something wrong. The request till this exception is raised is GET, not POST. I thought that on GET the token is generated and than is validated on post.

Please advice.<

Awesome HTML minifying function but causes problem at Google Adsense ads - Very Important !


function works perfectly. it makes source code single line. but problem is about Google Adsense ads. their locations get messed up. what might be the reason ?

programming language is c# asp.net 4.0

here the function



  protected override void Render(HtmlTextWriter writer)
    if (this.Request.Headers["X-MicrosoftAjax"] != "Delta=true")
      System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"<script[^>]*>[\w|\t|\r|\W]*?</script>");
      System.Text.StringBuilder sb = new System.Text.StringBuilder();
      System.IO.StringWriter sw = new System.IO.StringWriter(sb);
      HtmlTextWriter hw = new HtmlTextWriter(sw);
      string html = sb.ToString();
      System.Text.RegularExpressions.MatchCollection mym
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend