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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:19:24+00:00 2026-05-14T04:19:24+00:00

The code for the asp.net page is: <div class=facebox_content> <% if (CurrentUser.Role == Free)

  • 0

The code for the asp.net page is:

<div class="facebox_content">
<% if (CurrentUser.Role == "Free")
   {
%>
<table cellpadding="0" cellspacing="0" style="border-collapse:collapse;width:380px;">
    <tr>
        <td>
            User Name :
        </td>
        <td>
            Membership Cost :
        </td>
    </tr>
    <tr>
        <td style="width:190px;">
            <asp:TextBox ID="txtUserName" Enabled="false" runat="server" Text="<%= CurrentUser.Name %>"/>
        </td>
        <td style="width:190px;">
            <asp:TextBox ID="txtCost" Enabled="false" runat="server" Text="2000"/>

        </td>
    </tr>
    <tr>
        <td>
            <br />
            Cheque / Draft No.:
        </td>
        <td>
            <br />
            Bank Drawn On :
        </td>
    </tr>
    <tr>
        <td style="width:190px;">
            <asp:TextBox ID="txtChqNo" runat="server"></asp:TextBox>
        </td>
        <td style="width:190px;">
            <asp:TextBox ID="txtBankName" runat="server"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            <br />
            Date :
        </td>
        <td>
            <br />
            City :
        </td>
    </tr>
    <tr>
        <td style="width:190px;">
            <asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
        </td>
        <td style="width:190px;">
            <asp:TextBox ID="txtCity" runat="server"></asp:TextBox>
        </td>
    </tr>
</table>
<% 
   }
   else if(CurrentUser.Role == "Pending")
   {
%>
<p style="text-align:justify;">
    Your Request is pending with our Administrators.
    Please be patient while your request is processed.
    Usually it takes 2-4 Days for your request to be processed after the payment has been received. 
</p>
<% 
   }
   else if(CurrentUser.Role == "Paid")
   {
%>
<p style="text-align:justify;">
    You are already a Paid Member of Website
</p>
<% 
   }
%>

The code for the C# file is:

protected void Page_PreInit(object sender, EventArgs e)
{
    this.Theme = CurrentUser.Theme;
}

protected void Page_Load(object sender, EventArgs e)
{
    txtUserName.Text = CurrentUser.Name;
    ConfirmButton.Attributes.Add("onclick", "javascript:document.getElementById('" + lblMsg.ClientID + "').style.display='none';");

    if (CurrentUser.Role != "Free")
        ConfirmButton.Visible = false;
}

The code is giving the following error:

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.Add(Control child) +8678903
   System.Web.UI.PageTheme.SetStyleSheet() +478
   System.Web.UI.Page.OnInit(EventArgs e) +8699660
   System.Web.UI.Control.InitRecursive(Control namingContainer) +333
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378

Please some one help me out..!!

  • 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-14T04:19:24+00:00Added an answer on May 14, 2026 at 4:19 am

    Maybe you can try in another way:

    Aspx:

    <asp:PlaceHolder runat="server" ID="FreeHolder" Visible="false">
        <table> ... </table>
    </asp:PlaceHolder>
    <asp:PlaceHolder runat="server" ID="PendingHolder" Visible="false">
      <p style="text-align:justify;">
        Your Request is pending with our Administrators. ...
      </p>
    </asp:PlaceHolder/>
    <asp:PlaceHolder runat="server" ID="PaidHolder" Visible="false">
    ...
    </asp:PlaceHolder/>
    

    Code-Behind:

    if (CurrentUser.Role == "Free")
    {
        FreeHolder.Visible = true;
    } else if (CurrentUser.Role == "Pending") {
        PendingHolder.Visible = true;
    } else if (CurrentUser.Role == "Paid") {
        PaidHolder.Visible = true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in a ASP.NET master page: <div id=hyperlinkimage><asp:HyperLink ID=SomeHyperLink runat=Server
In code-behind of an ASP.NET page I have this method: public string TestFunc() {
I have an ASP.NET page with code-behind in VB.NET. On the ASPX page I
I create a asp.net page and test the code in debug mode step by
I have a normal asp.net page containing some code that I want to measure
Possible Duplicate: Get URL of ASP.Net Page in code-behind I'm trying to hold current
I had a code segment on an asp.net page in the code-behind file. I
I am using ASP.NET page methods with jQuery. Here is my code, $.ajax({ type:
The code behind file creates a list of employees and the asp.net page loops
I have an asp.net web page. The code: <%@ Page Language=C# AutoEventWireup=true CodeBehind=Login.aspx.cs Inherits=Works.Login

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.