Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6122961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:57:37+00:00 2026-05-23T15:57:37+00:00

I can make the same in Django using render_to(…) but ASP.NET. I need to

  • 0

I can make the same in Django using render_to(...) but ASP.NET.

I need to provide the different form in a single asp.net page, so I want to render custom form templates and pass it into a main page.

How to make this stuff?

I try this code

<%: Html.RenderPartial(ViewData["pd"].ToString(), ViewData)%>

and I get

'System.Web.Mvc.HtmlHelper<dynamic>' does not contain a definition for 'RenderPartial' and the best extension method overload 'System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(System.Web.Mvc.HtmlHelper, string)' has some invalid arguments

Sultan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:57:37+00:00Added an answer on May 23, 2026 at 3:57 pm

    I don’t know Django, but from your description it looks like you are talking about partial views. So you could define a partial (~/Views/Home/Foo.ascx):

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
    <div>some contents</div>
    

    and then in your main view include it:

    <%= Html.Partial("Foo") %>
    

    UPDATE:

    Now that you have shown your code it seems that you are using the RenderPartial method. This method doesn’t return anything. It writes directly to the output. You are using it incorrectly. It should be used like this:

    <% Html.RenderPartial(ViewData["pd"].ToString()); %>
    

    or you could also use the Partial helper:

    <%= Html.Partial(ViewData["pd"].ToString()) %>
    

    Now as far as passing info to this partial is concerned I would very very very strongly recommend you getting rid of any ViewData and use strongly typed views and view models. So for example you would have a strongly typed main view to this model:

    public class MyViewModel
    {
        public string Foo { get; set; }
        public SomeOtherViewModel Bar { get; set; }
    }
    

    and then you will be able to do this:

    <%= Html.Partial(Model.Foo, Model.Bar) %>
    

    and then have your partial strongly typed to SomeOtherViewModel:

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SomeOtherViewModel>" %>
    <div><%: Model.SomePropertyOfBar %></div>
    

    Or even better, use the templated helpers Html.DisplayFor and Html.EditorFor. They are the best way to include partials into an ASP.NET MVC application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In PHP, you can make two variables point to the same data. $a =
ASP.NET does not allow concurrent requests for the same session; meaning that a user
I can make a DAO recordset in VB6/Access do anything - add data, clean
I can make Firefox not display the ugly dotted focus outlines on links with
In C# you can make a block inside of a method that is not
so that you can make your program concurrent easily in the future.
I know that I can make a setter that checks to see if a
Is there anyway I can make the process of adding references to C# projects
Now that I can make useful user controls in WPF (thanks to this stackoverflow
Sometimes a labeled break or continue can make code a lot more readable. OUTERLOOP:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.