DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 03 Aug 2007 09:04:49 -0000,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Sebastian Paul
          2    Sebastian Paul
          3    Sebastian Paul
          4    Sebastian Paul


DataList ignores Styles when WebControlAdapter applies   
Hi,
I registered a WebControlAdapter for any WebControl, that removes all
ID attributes (I actually do not need them). Everything works as
expected, but the DataList ignores any styles (ItemStyle,
SelectedItemStyle etc.). The DataList works as usual, i.e. it uses the
SelectedItemTemplate for the selected item.
Other controls, such as the TreeView, apply their styles properly.

Any idea what's going wrong? It seems like a bug for me. Currently,
the only workaround I see is to create a special adapter for the
DataGrid and render the table myself.

You can reproduce this by adding a .browser file like this:
<browsers>
	<browser refID="Default">
		<controlAdapters>
			<adapter controlType="System.Web.UI.WebControls.WebControl"
	
adapterType="System.Web.UI.WebControls.Adapters.WebControlAdapter" />
		</controlAdapters>
	</browser>
</browsers>

In that case, the base class for WebControlAdapters is used. It should
render the control as usual, shouldn't it?

Kind regards, Sebastian
Date:Fri, 03 Aug 2007 09:04:49 -0000   Author:  

Re: DataList ignores Styles when WebControlAdapter applies   
....Now I see another issue with the DataList and WebControlAdapter.
When it is placed inside of a table cell, only the first data item is
rendered within that cell. The next item is rendered below the table
row containing the DataList - and so on! Every next item is rendered
before a table closes. Strange, isn't it?

I am using a GridView, this works fine with WebControlAdapter and even
within a DataList.

Kind regards, Sebastian
Date:Thu, 16 Aug 2007 14:43:49 -0000   Author:  

Re: DataList ignores Styles when WebControlAdapter applies   

> I am using a GridView, this works fine with WebControlAdapter and even
> within a DataList.

Ok, this is not true when I replace the surrounding DataList by a
Repeater. But nevertheless, I found the source: Both, DataList and
DataGrid render a <table> element around their usual table. This
disturbs the DOM, because <table> elements should contain rows and
cells.

I was able to fix that behaviour by overriding WebControlAdapter's
RenderBeginTag and RenderEndTag methods. This derived
WebControlAdapter cannot be used for all controls, because most of
them need their begin and end tags. (I was surprised that the CPU load
grows incredibly when using this for all controls. I think the
HtmlWriter does something wierd here.)

Unfortunately I still don't know what causes DataList and DataGrid to
discard their Item styles. Maybe I misunderstood some important things
about the ControlAdapter stuff. As I said, I just want to modify just
some aspects (i.e. remove IDs) instead of completely exchange the
rendering process.

Kind regards, Sebastian
Date:Fri, 17 Aug 2007 07:55:34 -0000   Author:  

Re: DataList ignores Styles when WebControlAdapter applies   

> Unfortunately I still don't know what causes DataList and DataGrid to
> discard their Item styles.

Seems like I got it. The DataGrid simply does not need an adapter. So
I exclude the control like that:

	<controlAdapters>
		<adapter controlType="System.Web.UI.WebControls.DataList"
			adapterType="" />
		<adapter controlType="System.Web.UI.WebControls.GridView"
			adapterType="" />
		<adapter controlType="System.Web.UI.WebControls.WebControl"
			adapterType="MyNamespace.MyWebControlAdapter" />
	</controlAdapters>

That way, all controls (inclusive those created by DataList or
DataGrid) are rendered by my Adapter, but the DataGrid itself behaves
as normal.

Sebastian
Date:Fri, 17 Aug 2007 09:32:36 -0000   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us