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 8775075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:43:06+00:00 2026-06-13T18:43:06+00:00

I have a nestedGridTemplate which contains one object of a list. this.Gridparent.MasterTableView.NestedViewTemplate = new

  • 0

I have a nestedGridTemplate which contains one object of a list.

            this.Gridparent.MasterTableView.NestedViewTemplate = new Custom14NestedTemplate(this.model.Material.First());

This calls my class public class Custom14Template.

This class calls :

    public void InstantiateIn(System.Web.UI.Control container)
    {
        var myPage = new Page();
        Control c = myPage.LoadControl("~/Custom14/Templates/View.ascx");
        container.Controls.Add(c);

        var x = new Label();
        x.Text = string.Format("qty : {0}.<br />", this.MyMaterial.Quantity);
        container.Controls.Add(x);
    }

Right now, my ascx contains only this :

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="View.ascx.cs" Inherits="*snip*.Templates.View" %>

hello there

Everything is displayed correctly

  [grid start]
  [item 1 : expanded]
     hello there qty : 23.
  [/item 1]
  [item 2 /]
  [item 3 /]
  [/grid]

I’d like to pass my object to my ASCX, to build my html display from there using… The old equivalent of <%= html.EditorFor() %> (Asp.Net MVC). Instead of creating elements like my label and adding them to the container (building html in c# feels painful). Is that doable? How?

  • 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-06-13T18:43:07+00:00Added an answer on June 13, 2026 at 6:43 pm

    I adapted this answer to my need (no ICustomControl) :

    The calling file contains the following :

        public void InstantiateIn(System.Web.UI.Control container)
        {
    
           Page myPage = new Page();
           Control userControl = myPage.LoadControl("~/Templates/Edit.ascx");
    
           //this is the important part
           if (userControl is Edit)
           {
               Edit customControl = userControl as Edit;
               customControl.MyObject= this.PersistedObject;
           }
    
            container.Controls.Add(userControl);
        }
    

    The .ascx.cs was also modified a bit :

    public partial class Edit : System.Web.UI.UserControl
    {
    
        public Produit MyObject { get; set; }
    
        protected void Page_Load(object sender, EventArgs e)
        {
            this.product.Text = MyObject.ProductName;
            this.Production.Text = MyObject.Production.ToString();
    
        }
    }
    

    And the ascx just contains two plains, regulars asp:textbox (ID= product and production).

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

Sidebar

Related Questions

have written this little class, which generates a UUID every time an object of
Have deployed numerous report parts which reference the same view however one of them
Have a SQL problem, adding this model all works correctly, the problem is in
Have two tables say ABC and XYZ and contain one column which data will
have Googled the cr*p out of this one so apologies if the answer is
Have a simple one-off tasks which needs a progress bar. OpenSSL has a useful
Have converted devise new session from erb to Haml but doens't work, this is
Have the following code: String s= v.request(engine/?key=, P4z72NmBa91&method=load); JSONParser parser = new JSONParser(); Object
Have you ever tried working with a XAML file which contains thousand tons of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=

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.