If you are creating new sites or web application projects and are targeting a framework 2.0, 3.0 then the ListView (and other System.Web.Extensions) control will not appear in the toolbox or have a reference mapping to the tagprefix in Web.config. However,
if you target FX3.5, they will appear and the config contain those entries.
It seems like you are saying that the existing application did target FX 3.5, Then you open the site in SP1 and ListView is broken. I would expect web.config to contain these items already - can you confirm? Can you also confirm that the target FX is still
3.5?
Is this occurring just for this control? Yes :( This is most obscure fact :( All other controls from this assembly (System.Web.Extensions) seems works correct. I can't define ListView in aspx file, i get error "Unknown
server tag 'asp:ListView". But i can write in backend CS file code like "ListView a = new ListView()" and this code i can compile successfully. It's very strange :( Web.Config is correct. I use (for test) new Web.Config from clean App.
http://saddo.ru/temp/Web.config
If you create a brand new web app - targeting 3.5, are the controls parsed and referenced correctly? I tried. No difference from previus projects.
Can you delete the "Temporary ASP.NET Files" for this appliction to cause an entire re-compilation - just to ensure it is clean? I already tried this (
Using a server control in 3.5 and getting Unknow Server Tag, worked in previous .NET versions. I created a new 3.5 web project and put the server control in. Worked fine for a few test runs then stopped working and the Unknow Server Tag emerged. Stuck with
3.5 because I'm using LINQ.
I have done all sort of other things like regenerating the designer, the web.config. using AJAX, not using AJAX, using a master page, not using a master page, etc. Bottom like something is bugged in 3.5 where server controls are concerned.
Fix it Microsoft, were washing hours on this, NOT RAD. While your at it fix the conditional LINQ logic please.
Sure, the issue btw is mostly with the designerin 3.5. It's not completely dynamic and does some sort of lazy re-rendering. You can see it in action by pasting HTML in a form versus typing it. It's all over the web and mostly what I do to get around it is
delete the designer and then "Convert to Web Application" on the form. In this example the server control worked fine through 2 runs then spontaneously went Unknown. It's actually working again now since I closed VS 2008 IDE and reopened it but will soon
go Unknown again. Many have used the reopening to get things working again.
<%
@
Page
Language="C#"
AutoEventWireup="true"
CodeFile="rating2.aspx.cs"
Inherits="rating" %>
<%@
Register
Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI"
TagPrefix="asp" %>
<%@
Register
TagPrefix="MyBar"
Namespace="MyVote" %> (haved tried many tweaks on this directive)
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace
MyVote
{
public
class
Voting : WebControl,INamingContainer
{
private
string voteNumber;
private
int iStarCount = 3;
private
string overImageUrl;
private
string outImageUrl;
private ImageButton im;
public
event
EventHandler Click;
public
string VoteCount
{
get {
return voteNumber; }
set { voteNumber =
value; }
}
public
string MouseOver_ImagePath
{
get {
return overImageUrl; }
set { overImageUrl =
value; }
}
public
string MouseOut_ImagePath
{
get {
return outImageUrl; }
set { outImageUrl =
value; }
}
public
int StarCount
{
get {
return iStarCount; }
set { iStarCount =
value; }
}
protected
override
bool OnBubbleEvent(object source,
EventArgs e)
{
if (e
is CommandEventArgs)
{
CommandEventArgs ce = (CommandEventArgs)e;
if (ce.CommandName ==
"Click")
{
VoteCount = ce.CommandArgument.ToString();
OnClick(ce);
}
}
return
true;
}protected
virtual
void OnClick(EventArgs e)
{
if (Click !=
null)
{
Click(this, e);
}
}
First of all, you are registering the AJAX Extensions 1.0 in a 3.5 application that already has AJAX included. You need to remove this.
Secondly, is your server control strongly named? If not, then you need to strongly name it and add it as an assembly to your web.config. You can either register it in the web.config or include the Register directive in the ASPX page, but you will need
to include its public key token like all other assemblies.
Christopher Reed, MCT, MCPD, MCTS, Microsoft Specialist, MTA
"The oxen are slow, but the earth is patient."
Thanks Christopher, that second AJAX registration was inadvertent, left over from trying everything. Did also register the server control in the config file before but appreciate the suggestions. The funny thing is it working for a time then going south,
something with the designer I hope gets fixed. Recommend not copying HTML or ASP controls into a page until it is.
SimonCal
Participant
1910 Points
384 Posts
Microsoft
Re: .NET 3.5 and asp:listview
Aug 15, 2008 06:38 PM|LINK
If you are creating new sites or web application projects and are targeting a framework 2.0, 3.0 then the ListView (and other System.Web.Extensions) control will not appear in the toolbox or have a reference mapping to the tagprefix in Web.config. However, if you target FX3.5, they will appear and the config contain those entries.
It seems like you are saying that the existing application did target FX 3.5, Then you open the site in SP1 and ListView is broken. I would expect web.config to contain these items already - can you confirm? Can you also confirm that the target FX is still 3.5?
<assemblies>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
This posting is provided "AS IS" with no warranties, and confers no rights.
TwilightLord
Member
8 Points
4 Posts
Re: .NET 3.5 and asp:listview
Aug 15, 2008 06:53 PM|LINK
I would expect web.config to contain these items already - can you confirm?
Yes, of course. My web.config contains this lines.
Can you also confirm that the target FX is still 3.5?
Yes
SimonCal
Participant
1910 Points
384 Posts
Microsoft
Re: .NET 3.5 and asp:listview
Aug 15, 2008 10:24 PM|LINK
Hope you don't mind but here are a few more questions..
Is this occurring just for this control? Are you using the ScriptManager anywhere in your app for example - I would expect the same exception?
If you create a brand new web app - targeting 3.5, are the controls parsed and referenced correctly?
Can you delete the "Temporary ASP.NET Files" for this appliction to cause an entire re-compilation - just to ensure it is clean?
Many thanks
This posting is provided "AS IS" with no warranties, and confers no rights.
TwilightLord
Member
8 Points
4 Posts
Re: .NET 3.5 and asp:listview
Aug 15, 2008 11:54 PM|LINK
Is this occurring just for this control?
Yes :( This is most obscure fact :( All other controls from this assembly (System.Web.Extensions) seems works correct. I can't define ListView in aspx file, i get error "Unknown server tag 'asp:ListView". But i can write in backend CS file code like "ListView a = new ListView()" and this code i can compile successfully. It's very strange :( Web.Config is correct. I use (for test) new Web.Config from clean App. http://saddo.ru/temp/Web.config
If you create a brand new web app - targeting 3.5, are the controls parsed and referenced correctly?
I tried. No difference from previus projects.
Can you delete the "Temporary ASP.NET Files" for this appliction to cause an entire re-compilation - just to ensure it is clean?
I already tried this (
TwilightLord
Member
8 Points
4 Posts
Re: .NET 3.5 and asp:listview
Aug 17, 2008 07:32 PM|LINK
Sad, but i haven't time to search bug :( I reinstall all system from scratch. :(
kcovert
Member
6 Points
3 Posts
Re: .NET 3.5 and asp:listview
Feb 28, 2009 03:51 PM|LINK
Using a server control in 3.5 and getting Unknow Server Tag, worked in previous .NET versions. I created a new 3.5 web project and put the server control in. Worked fine for a few test runs then stopped working and the Unknow Server Tag emerged. Stuck with 3.5 because I'm using LINQ.
I have done all sort of other things like regenerating the designer, the web.config. using AJAX, not using AJAX, using a master page, not using a master page, etc. Bottom like something is bugged in 3.5 where server controls are concerned.
Fix it Microsoft, were washing hours on this, NOT RAD. While your at it fix the conditional LINQ logic please.
Careed
All-Star
18764 Points
3637 Posts
Re: .NET 3.5 and asp:listview
Mar 01, 2009 01:06 PM|LINK
Can you provide some code for this or a website that is accessible to test it?
As for telling Microsoft something, this is not the place. You need to go through some more formal channels if you believe that this is a bug issue.
"The oxen are slow, but the earth is patient."
kcovert
Member
6 Points
3 Posts
Re: .NET 3.5 and asp:listview
Mar 01, 2009 01:42 PM|LINK
Sure, the issue btw is mostly with the designerin 3.5. It's not completely dynamic and does some sort of lazy re-rendering. You can see it in action by pasting HTML in a form versus typing it. It's all over the web and mostly what I do to get around it is delete the designer and then "Convert to Web Application" on the form. In this example the server control worked fine through 2 runs then spontaneously went Unknown. It's actually working again now since I closed VS 2008 IDE and reopened it but will soon go Unknown again. Many have used the reopening to get things working again.
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="rating2.aspx.cs" Inherits="rating" %><%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register TagPrefix="MyBar" Namespace="MyVote" %> (haved tried many tweaks on this directive)
<
body><form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<strong><span style="font-size: 14pt; font-family: Verdana">Rating Control</span></strong><br />
<MyBar:voting runat="server" id="RatingCtrl" width="200px" StarCount="10" MouseOut_ImagePath="Images/star.jpg" MouseOver_ImagePath="images/starover.jpg" OnClick="RatingCtrl_Click" ></MyBar:voting>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
The Class File:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace
MyVote{ public class Voting : WebControl,INamingContainer
{
private string voteNumber;
private int iStarCount = 3;
private string overImageUrl;
private string outImageUrl;
private ImageButton im;
public event EventHandler Click; public string VoteCount
{
get { return voteNumber; }
set { voteNumber = value; }
} public string MouseOver_ImagePath
{
get { return overImageUrl; }
set { overImageUrl = value; }
}
public string MouseOut_ImagePath
{
get { return outImageUrl; }
set { outImageUrl = value; }
} public int StarCount
{
get { return iStarCount; }
set { iStarCount = value; }
} protected override bool OnBubbleEvent(object source, EventArgs e)
{
if (e is CommandEventArgs)
{
CommandEventArgs ce = (CommandEventArgs)e;
if (ce.CommandName == "Click")
{
VoteCount = ce.CommandArgument.ToString();
OnClick(ce);
}
}
return true;
}protected virtual void OnClick(EventArgs e)
{
if (Click != null)
{
Click(this, e);
}
}
protected override void CreateChildControls(){
for (int i = 1; i < StarCount + 1; i++)
{
im = new ImageButton();
im.ImageUrl = MouseOut_ImagePath ;
im.Attributes.Add("onmouseover", "this.src='" + MouseOver_ImagePath + "';");
im.Attributes.Add("onmouseout", "this.src='" + MouseOut_ImagePath + "';");
im.AlternateText = i.ToString();
im.ID = "but" + i.ToString();
im.CommandName = "Click";
im.CommandArgument = i.ToString();
Controls.Add(im);
}
}
}
}
The Virgin web.config:<?
xml version="1.0"?> <configuration><
configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"><
sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/><
sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/><
section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/><
section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/></sectionGroup></sectionGroup></sectionGroup></configSections><appSettings/> <connectionStrings/><
system.web> <pages><
controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/><
add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </controls></
pages> <!--Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
--><
compilation debug="true"> <assemblies><
add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/><
add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation><!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
--><
authentication mode="Windows"/><!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
--><
httpHandlers> <remove verb="*" path="*.asmx"/><
add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/><
add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpHandlers> <httpModules><
add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpModules></system.web> <system.codedom><
compilers> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4"><
providerOption name="CompilerVersion" value="v3.5"/> <providerOption name="WarnAsError" value="false"/></compiler></compilers></system.codedom><!--The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
--><
system.webServer> <validation validateIntegratedModeConfiguration="false"/><
modules> <remove name="ScriptModule"/><
add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></modules> <handlers><
remove name="WebServiceHandlerFactory-Integrated"/> <remove name="ScriptHandlerFactory"/><
remove name="ScriptHandlerFactoryAppServices"/> <remove name="ScriptResource"/><
add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/><
add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></handlers></system.webServer> <runtime><
assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly><
assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly><
dependentAssembly> <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/><
bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly></assemblyBinding></runtime></configuration>Careed
All-Star
18764 Points
3637 Posts
Re: .NET 3.5 and asp:listview
Mar 02, 2009 11:37 AM|LINK
First of all, you are registering the AJAX Extensions 1.0 in a 3.5 application that already has AJAX included. You need to remove this.
Secondly, is your server control strongly named? If not, then you need to strongly name it and add it as an assembly to your web.config. You can either register it in the web.config or include the Register directive in the ASPX page, but you will need to include its public key token like all other assemblies.
"The oxen are slow, but the earth is patient."
kcovert
Member
6 Points
3 Posts
Re: .NET 3.5 and asp:listview
Mar 02, 2009 11:04 PM|LINK
Thanks Christopher, that second AJAX registration was inadvertent, left over from trying everything. Did also register the server control in the config file before but appreciate the suggestions. The funny thing is it working for a time then going south, something with the designer I hope gets fixed. Recommend not copying HTML or ASP controls into a page until it is.