views:

245

answers:

0

Hello colleagues,

I have ascx control inside FormView. What I would like is use syntax Bind inside ascx. Here is my page:

    <asp:ObjectDataSource runat="server" ID="ods" TypeName="MyDS" SelectMethod="Get" UpdateMethod="Update" DataObjectTypeName="Ent">
    </asp:ObjectDataSource>
    <asp:FormView runat="server" DefaultMode="Edit" ID="fv1" DataSourceID="ods">
        <EditItemTemplate>
            <uc1:WebUserControl ID="WebUserControl1" runat="server" />
            <asp:Button runat="server" CommandName="Update" Text="Update"/>
        </EditItemTemplate>
    </asp:FormView>

Here is WebUserControl.ascx:

<asp:TextBox ID="txt1" runat="server" Text='<%# Bind("Name") %>' />

On selecting values into the TextBox everything works fine. Bind populates textbox with expected value. But when button "Update" pressed the ObjectDataSource's method Update gets instance of Ent with null instead Name, while entered text is expected. Just for test I have placed textbox into the .aspx and everything works fine.

At last I have decompiled by reflector FormView, where ExtractRowValues looks failed since iterates only over direct children. Does anybody know how to work around with child bindings?