Strange problem with asp.net site
I have created an asp website and I have the following problems: -
I am using the master page in it and have defined two content holders, one of which is in the header, and I have specified the page title in the topmost directive in the @page directive, but the page title does not show up. I need to manually add a tag to it.
Secondly, when I create a content page from the master page, it creates it, and when I rename it, it doesn't rename it. It remains _Default, so every page has _default inheritance.
Most importantly
I am using a page to enter and view data in a database. I used a boolean name isadmin
that I set according to the credentials on page load. and I will add a panel where the visible property is set to Visible = '<%#IsAdmin %>'
. It works correctly when I run it through the visual studio environment, but when I publish and run it, it doesn't work and the panel just comes in and stays there. Why is this happening? Any ideas? Thanks to
The visible issue is fixed as I had to enable Windows Authentication on the server. Waiting for answers on two other questions. Thanks to
a source to share
- Try adding
<head runat=server>
to your homepage. Only then can ASP.net "see" the tag and change it. - It's not too bad that multiple aspx pages have the same class names. ASP.NET 2.0 started to treat each page as its own compilation unit or so. Pages cannot see each other. There is a special directive for pages to look at each other and imperialize or manipulate them. Therefore, he should not harm.
- Perhaps you haven't checked it correctly and are wrong that it works in Visual Studio ??? But anyway, I would suggest that you move your logic to OnInit, then it works much earlier. I think the control tree is created before Page.OnLoad. What you are doing is data binding which can only work when DataBind is called, I'm not sure if
Or use the safe way: create a property IsAdmin
so that it is initialized on first call and cache the result in a variable
a source to share