ASP.NET TargetSchema user control directive - asp.net

I have several user controls that look like this:
<%# Control Language="vb" AutoEventWireup="false"
Inherits="classname"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"
Codebehind="classname.ascx.vb"
%>
I know that TargetSchema was supposed to give Visual Studio help with Intellisense when working with asp/html pages. Does it still do anything or is it just ignored? I don't see any obvious difference, and of course the version number is way out of date, but if it's still doing something useful, I wouldn't want to just delete it willy-nilly.

Related

How do I find out where .aspx page is pulling its header?

I haven't worked with C# or ASP.NET before, but I'm trying to update some .aspx pages on a site. I'm noticing that there are also some updates that also need to be made in the <head> when I look at the source of the page, but I don't know how to determine where that header info is being pulled from to make that change.
Here are the two lines I'm seeing before it jumps into the HTML content:
<%# Page Language="vb" AutoEventWireup="false" Codebehind="DefaultLogin.aspx.vb" Inherits="TIMSSSSO.Web.DefaultLogin" %>
<%# Register TagPrefix="cc1" Namespace="Generic.Foundation.WebControls" Assembly="Generic.Foundation.WebControls" %>
Does any of this tell me where I should go to edit the header? Any guidance would be appreciated.

Recompiling old ASP.NET page .dll's from new VB Codebehind?

I'm the newly appointed tech-guy at a small company. I've inherited their near-complete ASP.NET web page that's been left "near-complete" for some time, but I'm not really familiar with ASP.NET. It was dropped by the original developers a few years ago, and a year or so back someone tried to finish it using only inline code.
Now that I've unearthed the old VB source files, I've made a one-line change to the Page.aspx.vb and need get it associated to it's Page.aspx file. Trouble is, the #Page directive directly inherits its own App_Web_Page.xxxxxx.dll. Every page does this. This is not reflected in the source I have to work with, but is the way it now operates. The last person to touch it has long since forgotten the details of his work, and I'm not familiar enough with ASP.NET to know what to ask.
So my #Page directive goes like so:
<%# page language="vb" autoeventwireup="false" inherits="Page,
App_Web_page.aspx.cdcab7d2" masterpagefile="~/Master.Master"
enablesessionstate="True" enableEventValidation="false" %>
When I try to precompile the site, my #Page directives look totally different:
<%# page language="vb" autoeventwireup="false" Codebehind="Page.aspx.vb"
inherits="Project.Page" masterpagefile="~/Master.Master"
enablesessionstate="True" enableEventValidation="false" %>
And, being precompiled, It doesn't yield a page-unique .dll file I can just swap into the live bin directory and change the #Page directive for. I've tried a number of permutations on the #Page directive to try to get it to compile the new VB code on access, but I always wind up with errors, the best of which tell me ASP elements in the .aspx aren't defined in the .aspx.vb.
Can someone point me in the right direction with this?
You have to select the option like below highlighted...

what is the meaning of this?

I know that this will sound stupid to some of you, but when an ASPX page has something like this:
<%# Page Title="[$TITLES_listevents{uneditable}]" Language="C#" MasterPageFile="~/sitebase/templates/page.master" AutoEventWireup="true" CodeBehind="list.aspx.cs" Inherits="list" %>`
or something like:
<div id="panelGroupEventPackageOnlyDescription" runat="server" visible="<%# ShowGroupEventPackageOnly %>">
[$ITEMLIST_groupeventpackageonly]
</div>
what does it mean?
Regards
I'm assuming that your query is for the bits that look like this: Title="[$TITLES_listevents{uneditable}]"
It doesn't look like asp.net to me. It could be that the page was generated by a templating tool that left some rubbish behind, is it in source control, can you ask whoever created the page?
Hey All,
apparently it means that It will use site text to set the title, this is done when there is an xml file that produces site data and you need some of those data to be published dynamically to you front end website. this is the results of custom controls being used on things like label, dropdownbox etc...
this is one of the legacy piece of software where the one who wrote the code is gone AWOL with little doc, only happens when you are emerging from recession lol.....

Register User Control Issue

I have a user control registered at the top of my page:
<%# Register Src="/Controls/User/Navbar.ascx" TagName="Navbar" TagPrefix="pmc" %>
and I reference it in my page like this:
<pmc:Navbar runat="server" id="navbar"></pmc:Navbar>
but it does not know what <pmc:Navbar is. I cannot figure out why.
I'm using VS 2008, in a Web Application Project.
Maybe you should specify the path with ~: ... Src="~/Controls/User/Navbar.ascx" ...
Remove either the initial slash from the path to the control, or better still, prefix it with "~" :
<%# Register Src="Controls/User/Navbar.ascx" TagName="Navbar" TagPrefix="pmc" %>
or
<%# Register Src="~/Controls/User/Navbar.ascx" TagName="Navbar" TagPrefix="pmc" %>
The first solution is flakey as it relies on the page existing in the root folder and the control existing below it. The second is the preferred as it will work from any page in your project.
You should also consider registering your user controls in your web.config, as it keeps things much neater, and tends to avoid path issues a little better.

Strongly-typed ASCX in WebForms 3.5?

I'm looking to get rid of the code-behind for a control in my WebForms 3.5 application. Again bitten by the bug of how it's done in MVC, I'd like to get a step closer to this methodology by doing:
<%# Control Language="C#" Inherits="Core.DataTemplate<Models.NewsArticle>" %>
This gives me the parser error you'd expect, so I remembered back to when this was an issue awaiting a fix in the MVC Preview, and changed it to:
<%# Control Language="C#" Inherits="Core.DataTemplate`1[[Models.NewsArticle]]" %>
But this doesn't work either! How is it that the MVC team were able to harness this ability? Was it something special about the MVC project type rather than the latest VS2008 Service Pack?
Short of giving up and requiring future templates to have code-behind files, what are my best options to get this as close to the generic user control method as possible?
Well, it appears like I've managed to do it. After looking at the PageParserFilter implemented by the MVC team for ViewUserControl<T>, I was able to construct something similar for my own DataTemplate<T> purposes. Sweet. I can now use the line:
<%# Control Language="C#" Inherits="Core.DataTemplate<Models.NewsArticle>" %>
And, without any code behind file, it parses! I'll report back if I find that I've broken something else in the process!
With WebForms you lose pretty much everything that makes them useful without a code behind page, because then VS can't auto generate the designer file that holds the actual definitions for all your runat="server" controls.
What you can do is have a common base page class, and make that generic:
public class DataTemplate<T> : Page {
public T Model {get;set;}
}
public partial class MyCodeBehindClass :
DataTemplate<Models.NewsArticle> {
...
}
This would allow all the drag-drop component stuff that WebForms does to work unhindered, while also allowing you to access a strongly typed model on the page:
<%# Control Language="C#" Inherits="MyCodeBehindClass" %>
<% foreach( var item in Model ) { %>
<!-- do stuff -->
<% } %>

Resources