0

I have a custom server control that the markup looks like such:

<myLib:MyControl id="myid" runat="server">
    <controls>
        <asp:Textbox id="TxtTest" runat="server" />
        <asp:Button id="cmdTest" runat="server" />
    </controls>
</myLib:MyControl>

the controls property looks like this:

[PersistenceMode(PersistenceMode.InnerProperty)]
public List<Control> controls { get; set; }

For reasons I don't fully understand, if I fire a postback by clicking cmdTest, the value of txtTest is wiped out in the event handler for the button click. Does anybody have any ideas on where this could be happening? Thanks

Ant P
  • 24,820
  • 5
  • 68
  • 105
mrK
  • 2,208
  • 4
  • 32
  • 46
  • Can you provide some code for us to look at? This is a tricky aspect of custom control development, and it's difficult to say without seeing your implementation. – James Johnson Sep 16 '13 at 21:45
  • @JamesJohnson What code would be most useful? It's a fairly large code base, but I can get you anything that's necessary. – mrK Sep 17 '13 at 04:23

1 Answers1

0

For anybody who might stumble across this in the future, The problem I was having was only on textboxes and other inputs who's value might be changed during the page residing on the client. The problem was that (due to unnecessarily complex design), I was moving some of the child controls to the body of the document after the page was loaded. This was causing them not to reside in the form when it was submitted, and the values were not being persisted.

mrK
  • 2,208
  • 4
  • 32
  • 46