.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 - EditorFor - Not rendering additional viewData

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
Hay Have seen in the MusicStore PDF witch can be sownloaded from wwww.asp.net,That is it possible to render additional vew data.so:I have my ViewDataModelpublic class PageViewData : Cms.Web.Areas.Management.Model.ViewData.BaseViewData { public ICollection<Page> PageList { get; set; } public Page CurrentPage { get; set; } public ICollection<PageTemplate> PageTemplateList { get; set; } public ICollection<Language> LanguageList { get; set; } public PageViewData(IPrincipal user, MessageCollection messageCollection) : base(user, messageCollection) {} }I have the Model: public class Page : BasePage { public virtual string Keyword { get; set; } [Required] public virtual Language Language { get; set; } public virtual PageTemplate Template { get; set; } public virtual bool IsFrontPage { get; set; } public Page() { } } In my controller, I add the data into the model: public ActionResult New() { this.CmsViewData.CurrentPage = new Page(); this.CmsViewData.PageTemplateList = this.PageTemplateService.GetList(); this.CmsViewData.LanguageList = this.LanguageService.GetList(); return View("New", this.CmsViewData); } And I try to render it with H

View Complete Post

More Related Resource Links

Rendering ASP.NET Script References into the Html Header

One thing that I've come to appreciate in control development in ASP.NET that use JavaScript is the ability to have more control over script and script include placement than ASP.NET provides natively. Specifically in ASP.NET you can use either the ClientScriptManager or ScriptManager to embed scripts and script references into pages via code.

Rendering data with HTML tags in the DD Gridview for a selected column


I am having trouble finding out where and how to HTML Encode a cell's data on the Dynamic Data (v4.0) gridview of List.aspx.  As a simple case, suppose I have formatted cell data that is A<br/>B in the DB.    Obviously, I want A stacked on B in the cell.

It seems gridView1.HtmlEncode = true has gone away.

So maybe I'll try to catch it on the RowDataBound event:

protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)

            if (e.Row.RowType == DataControlRowType.DataRow)
                // Html Encode the cells


but this event never fires?

Has anyone figured out how to properly render HTML tags data in the List.aspx's GridView1? 

If I figure this out, then I can add a MetaAttribute called something like [EncodeAsHtml(true)] and be on my way.  Thanks!

Cutting Edge: Conditional Rendering in ASP.NET AJAX 4.0


Last month, Dino covered the basics of the new DataView client control and the binding techniques most commonly used. In this article, he goes one step further and covers conditional template rendering.

Dino Esposito

MSDN Magazine November 2009

Cutting Edge: Programming AJAX with ASP.NET Partial Rendering


Dino Esposito compares the use of AJAX patterns and DOM manipulations to the use of the ASP.NET partial rendering engine.

Dino Esposito

MSDN Magazine August 2008

Text Rendering: Build World-Ready Apps Using Complex Scripts In Windows Forms Controls


The System.Windows.Forms.TextRenderer class provides support for complex scripts in Windows Forms controls so you can render text the way you want and support international locales.

Miguel A. Lacouture

MSDN Magazine March 2006

Using Server-Side XSL for Early Rendering: Generating Frequently Accessed Data-Driven Web Pages in A


Dynamic data-driven pages have become the basis of many cutting-edge Web sites. Early render systems can provide better performance and maintainability for data-driven Web sites by generating frequently accessed pages that contain less-volatile information ahead of time. We'll show you an example of a server-side solution that uses Extensible Stylesheet Language (XSL) to merge data and layout information into HTML that is compatible with just about any modern Web browser. Using these techniques to render Web pages early can reduce the load on your database back end and increase performance for your users.

Paul Enfield

MSDN Magazine April 2000

Problems Rendering Special Characters


Good afternoon ASP programmers,

I am creating an application that creates math problems for students.  I wish to use a special character for negation to differentiate it from the minus sign.  I am using the Unicode character U02c9. 


This is a composite screen shot of two problems. The top one is rendered in Fire Fox and the bottom one in IE.  I'd like to know how to change my JavaScript so that IE is rendered like Fire Fox.  I have created variables that I use for my special characters.

var symMul= "×";
var symDiv= "÷";
var symNeg= "?";

Both IE & Fire Fox correctly render the symDiv and symMul symbols. Any suggestion would be greatly appreciated.




Rendering User Control content


I have a scenario where, the content is:
 ASP.NET Controls
      User Control
 ASP.NET Controls

The entire div code is rendered and is sent at a mail using the code:

Dim sw As New StringWriter()
Dim w As New HtmlTextWriter(sw)
Dim s As String = sw.GetStringBuilder().ToString()

This works fine except that the User Control does not get rendered.

Any way out, so that the User Control content is also rendered ?

Razor. Conditional Rendering.



I am using Razor and I need to display a String or the view property value on the following condition:

@if(String.IsNullOrEmpty(View.Title)) { @("Default Title") } else { @View.Title }

This is working. But can I make this simpler?

I tried the following:

@String.IsNullOrEmpty(View.Title) ? @("Default Title") : @View.Title

This is not working ...



Share Point integrated SSRS reports rendering when access from external site


Our client has a SharePoint (moss2007) site on Windows 2008, SQL2008 R2 Enterprise, and Reporting service is integrated with SharePoint

The authentication on the share point integration is set to windows, else the authentication for the SSAS datasource gives and error

The extranet zone ( forms) and intranet (Customer Forms) and default (Windows) zones are all access from inside the firewall and the reports render in each with no issues, as the datasources are configured to pass a sql username and password.

However, report rendering is a problem from the internet (external site), the following error is displayed:

An unexpected error occurred while connecting to the report server. Verify that the report server is avai

RDL Rendering (500 Internal Server) Error at Sharepoint Integrated Reporting Service


I have a serious problem that cannot be solved by googling around the keywords below:
sharepoint, moss 2007, reporting service, ssrs 2008, rendering, internal server error, ....

The error is;

"An error occurred during client rendering. The remote server returned an error: (500) Internal Server Error. "

Everything is O.K.;

* When I render the report from the REPORTSERVER (http://localhost/ReportServer)
* When the reports are scheduled to be sent by the reporting service (planned via MOSS 2007) 

But if I open (render) the RDL file from the sharepoint REPORTS LIBRARY interface, all of the reports fail with that internal error message above. 

It is weird also that parametrized reports are displayed without errors although the parameters are queried from a sql dataset. But I got the error when rendering the report after I've chosen a parameter  and order "apply/report"...

Possible causes how I met that error may be;

After I have installed (then uninstalled) AJAX extensions
After I have re-configured IIS Web Service Extensions list items

Possible solution alternatives I've found;

I've found a solution on MSDN replying a similar issue with an ideal cause of the error but an evreka answer but no sol

HTML.RenderPartial vs HTML.EditorFor


This maybe a lame question but I wanted to understand the detailed differences between HTML.RenderPartial and HTML.EditorFor. I am using ASP.NET MVC2 with Framework 4.

Can someone point me to a link?

Menu control rendering issue with IE8



Using VS2010, I created an ASP.NET 4.0 web application and simply added a couple of menu items below the "Home" menu item in the master page that's created by the project wizard. I made no other changes - no code, no stylesheet changes.

If I run the app locally then everything is fine. I suspect because the local IIS is responsive enough for the problem not to occur.

If I deploy the app to a web host (discountasp.net) then I see the menu render vertically for less than a second before it renders correctly. If I refresh the page a few times then usually I can see the menu vertical flash but sometimes I can't, so there's some sort of timing consideration.

I'm using IE8. The problem doesn't seem to occur with either Firefox 3 or Chrome.

Have others seen this problem?

Any suggestions for a fix?

I can supply the zipped up project if anyone wants it.


Video: Rendering SharePoint 2010 Data in Silverlight

This demonstration shows how to render file data from SharePoint in a Silverlight application. (Length: 6:12)

Video: Rendering SharePoint 2010 Media Files in Silverlight

This demonstration illustrates how to render SharePoint media files in a Silverlight application. (Length: 11:28)

Video: Rendering Data with SharePoint 2010 Controls

This demonstration illustrates how to render SharePoint 2010 data programmatically. (Length: 2:35)

Adding additional fields to my custom membership provider

Hi, i have been playing around with the membership provider model for the last week and have it got it working with a basic table schema.  The trouble i have is that i wish to add an additional field (eg First Name) but am not sure how i can do this.  Here's what i have so far: public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)    {        MembershipUser user = new MembershipUser(Name, username, providerUserKey, email, passwordQuestion, null, isApproved, false, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now);        string sql = "INSERT INTO USERS(USERNAME,PASSWORD,EMAIL,ISACTIVE) VALUES(@UID,@PWD,@EMAIL,@ISACTIVE)";        db.AddParameter("@UID", username);        db.AddParameter("@PWD", password);        db.AddParameter("@EMAIL", email);        db.AddParameter("@ISACTIVE", (isApproved == true ? "Y" : "N"));        int i = db.ExecuteNonQuery(sql); 
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