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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:30:59+00:00 2026-05-14T08:30:59+00:00

I have an ASP.net page which contains some controls. I generate this controls by

  • 0

I have an ASP.net page which contains some controls.

I generate this controls by code, [Actually I have a method which uses a stringBuilder and add Serverside tag as flat string on it]

My page shows the content correctly but unfortunately my controls became like a Client-side control

For example I had a LoginView on my generated code which dosen’t work, and also I had read some string from LocalResources which dosen’t appear on the page

What Should I do to make my generating method correct

here is the code

protected string CreateSubSystem(string id, string roles, string AnonymousTemplateClass, string href, string rolesContentTemplateClass, string LoggedInTemplateClass)
{
    StringBuilder sb = new StringBuilder();
    sb.Append("<div class=\"SubSystemIconPlacement\" id=\"");
    sb.Append(id);
    sb.Append("\"><asp:LoginView runat=\"server\" ID=\"");
    sb.Append(id);
    sb.Append("\"><AnonymousTemplate><div class=\"");
    sb.Append(AnonymousTemplateClass);
    sb.Append("\"></div><asp:Label ID=\"lblDisabled");
    sb.Append(id);
    sb.Append("\" runat=\"server\" SkinID=\"OneColLabel\" meta:resourcekey=\"lbl");
    sb.Append(id);
    sb.Append("\" /></AnonymousTemplate><RoleGroups><asp:RoleGroup Roles=\"");
    sb.Append(roles);
    sb.Append("\"><ContentTemplate><a class=\"ImageLink\" href=\"");
    sb.Append(href);
    sb.Append("\"><div class=\"");
    sb.Append(rolesContentTemplateClass);
    sb.Append("\"></div></a><asp:HyperLink runat=\"server\" CssClass=\"SubSystemText\" ID=\"lnk");
    sb.Append(id);
    sb.Append(" NavigateUrl=\"~/");
    sb.Append(href);
    sb.Append(" \" meta:resourcekey=\"lbl");
    sb.Append(id);
    sb.Append("\" /></ContentTemplate></asp:RoleGroup></RoleGroups><LoggedInTemplate><div class=\"");
    sb.Append(LoggedInTemplateClass);
    sb.Append("\"></div><asp:Label runat=\"server\" SkinID=\"OneColLabel\" ID=\"lblDisabledLoggedIn");
    sb.Append(id);
    sb.Append("\" meta:resourcekey=\"lbl");
    sb.Append(id);
    sb.Append("\" /></LoggedInTemplate></asp:LoginView>");
    sb.Append("</div>");
    return sb.ToString();
}

I also use this method on page_PreRender event

  • 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-14T08:31:00+00:00Added an answer on May 14, 2026 at 8:31 am

    You need to instantiate the server side control and then append them to the parent node. You cannot dump markup on client to get server side control.

    As asp.net engine consumes the server controls and then render the correct client markup for you. So once on client end and free from the server side

    Dim t As TextBox
    t = New TextBox
    PlaceHolder1.Controls.Add(t)
    

    Try this This simple expample. Hope that helped 🙂

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

Sidebar

Related Questions

I have a page which contains a html.RenderPartial, that renders an ASP.NET MVC partial
I have user control on a ASP.NET web page, which contains a GridView and
I have an ASP.NET page which has a script manager on it. <form id=form1
I have an ASP.NET page which has a button it it. The button click
I have a ASP.NET page which allows an administrator to change the password for
I have a ASP.NET page which has a form on it. It also has
I have an asp.net page which is returning a list of object as a
I have an asp.net page which launches a child page in another browser window
I have an asp.net / C# page which takes a comment, and then emails
I have an ASP.NET 3.5 page which has multiple span elements with ID containing

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.