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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:05:33+00:00 2026-06-18T06:05:33+00:00

So I am using asp.net to make a site, and I came across a

  • 0

So I am using asp.net to make a site, and I came across a bit of a problem. I need to edit the html from an .aspx.cs file, and while this normally isn’t a problem, the html file is located in a templates folder elsewhere in the project. I have tried using javascript, but I kept getting errors saying “cannot setAttribute/change innerHTML of type null.

Would it be better to continue trying to fix this with javascript, or does asp.net have something for this?

ALSO NOTE: the html is in an html file, not a .aspx file, so asp.net controls (such as runat=”server”) don’t work.

EDIT: What I am trying to do is hide a div that holds a navigation bar for admins if the current user is not an admin.

For javascript fixes, I have tried Page.RegisterStartUpScript and Response.Write (called from the .aspx.cs file), but both give me the error described above. I can’t (as far as I know) have a javascript file just hide the div without somehow being called or originated by the c#, as I need to find out whether or not they are an admin

  • 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-18T06:05:34+00:00Added an answer on June 18, 2026 at 6:05 am

    What you need to do is convert the HTML document to an .aspx file and include it (Ref. http://www.mikesdotnetting.com/Article/144/Classic-ASP-Include-Files-in-ASP.NET) in the other documents where it is to be used. Then, you can reference the control in your code behind, using whatever methods are available to you for determining whether or not a user is logged in. For example:

    if (Security.IsLoggedIn())
    {
      myIncludeFile.Visible = true;
    }
    else
    {
      myIncludeFile.Visible = false;
    }
    

    Does that make sense to you?

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

Sidebar

Related Questions

I Need to make a webpage. asp.net this webpage recieve parameter by using Request.Querystring
I'm trying to make a login page using html, ajax & ASP.NET.The data is
I am making a web site using ASP.net, and i would like to make
I'm trying to develop a MultiLanguage web site using ASP.NET with C# My problem
Is it possible to make a site with ASP.NET MVC Framework using .NET 2.0?
I am using asp.net mvc and jquery to make ajax requests and when the
I'm creating a database application using ASP.NET and I want to make a Windows
My asp.net application is not using formsauthentication. Instead we make a call to database,
I'm using jQuery to make an Ajax call using an Http Post in ASP.NET
Using ASP.Net MVC on my Site.Master I have: <head runat=server> <title><asp:ContentPlaceHolder ID=TitleContent runat=server />

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.