Question

So this is my first attempt at using skins in asp.NET. I find the concept to be fairly straightforward - or so I thought.

My .skin file looks like this:

<asp:TextBox runat="server" CssClass="textBox"></TextBox>

<asp:Button runat="server" CssClass="button"></asp:Button>

<asp:GridView runat="server" Font-Underline="False" CssClass="noborder"
    AllowPaging="true" AutoGenerateColumns="false" Width="100%" PagerStyle-CssClass="pagingrow"
    PagerSettings-Mode="NextPreviousFirstLast" PagerSettings-NextPageText="Next"
    PagerSettings-PreviousPageText="Prev"  PagerSettings-FirstPageText="First"
    PagerSettings-LastPageText="Last" AllowSorting="true"
    HeaderStyle-CssClass="headerrow" RowStyle-CssClass="itemrow" AlternatingRowStyle-CssClass="altrow">
    <EmptyDataTemplate>
        <asp:Label runat="server" ID="lblNoData" Text="No data matches your request."></asp:Label>
    </EmptyDataTemplate>
</asp:GridView>

Apparently I've done something wrong here because I keep getting the following error:

The 'Text' property of 'asp:TextBox' does not allow child objects.

Referencing the line in my .skin file where I set the skin for the textbox.

I can't begin to think what this problem could be because nothing anywhere (yet) is using any of my textboxes Text properties... So what's gone wrong here?

Was it helpful?

Solution

I believe that as you have typo in TextBox closing tag, ASP.NET engine consider all controls next to textbox as childs of default Text property

Fix this: <asp:TextBox runat="server" CssClass="textBox"></TextBox>

Should be: <asp:TextBox runat="server" CssClass="textBox"></asp:TextBox>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top