2

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?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Ortund
  • 8,095
  • 18
  • 71
  • 139

1 Answers1

4

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>

Yuriy Rozhovetskiy
  • 22,270
  • 4
  • 37
  • 68
  • It's always the simplest things that we miss isn't it... Thanks :) – Ortund Feb 19 '13 at 07:36
  • 1
    There's a [campaign to clean up Stack Overflow](http://meta.stackexchange.com/q/167342) by removing these typo-related questions - we could really use your help! Would you mind pitching in a little by casting a close vote on this question? – PeeHaa Mar 01 '13 at 00:10