User1285297674 posted
I asked this question a while ago, but I probably didn't describe it well enough, so here goes again!
I have a user control that wraps a gridview. The user control exposes the Columns property in its class definition.
Any page that uses this user control can still use the familiar GridView Columns tag in the markup (as roughly illustrated below) and the page works as expected. The wrapped gridview user control renders fine with the columns specified.
The problem with this is that intellisense stops working on the Columns element and any element inside the Columns element in the User control markup definition (e.g. BoundField, TempalteField, LinkButton etc) and the Accessibilty check throws up warnings for
these user controls. It means you have to remember or lookup the attributes for each tag you use, unless you can remember.
Is there anyway to have Intellisense correctly function for nested items in this way or would you have to use a custom Control or something?
This post (http://forums.asp.net/t/1299374.aspx) looked promising - the item marked as answer I thought was a similar sort of problem.
Many thanks
---
Rough example code, not tested.
User Control (WrappedGridview.ascx) markup:
<div>
<asp:GridView ID="gv" runat="server" ...>
</asp:GridView>
</div>
User Control code behind (WrappedGridview.ascx.cs) code behind:
...
public DataControlFieldCollection Columns
{
get { return gv.Columns; }
}
...
Page markup (SomePage.aspx):
<uc1:WrappedGridview>
<Columns>
<asp:BoundField ...>
<asp:TemplateField ...>
<ItemTemplate>
<asp:LinkButton ...>
...
</ItemTemplate>
</Columns>
...
</uc1:WrappedGridview>