Asp:FormView inside ext:ContentPanel

Apr 8, 2010 at 2:31 PM

I am trying to use an asp:FormView element with ItemTemplate inside a ext:ContentPanel to maintain the look and field consistent and encapsulate my form in a panel.

I don't see any ext controls that work like the asp:FormView which would be my preferred approach but since there are no replacements I am using asp:FormView.

My problem is that the web site does not compile due to the binding statements in all the textbox controls, for example:

<asp:textbox Text='<%# Bind("Id") %>' .../>

does not pass page compilation with the error "The name 'Bind' does not exists in the current context".

Any ideas of how to work data element bindings in the FormView controls within your ContentPanel?



Apr 8, 2010 at 4:18 PM
Edited Apr 8, 2010 at 4:19 PM
<%--Use the following code to bind to DataTable--%>
<%# DataBinder.Eval(Container.DataItem, "MyValue") %>
<%--Use the following code to bind to List
<%# DataBinder.Eval(Container.DataItem, "MyText") %>--%>
<asp:textbox Text='<%# DataBinder.Eval(Container.DataItem, "Id") %>' .../>
Apr 8, 2010 at 4:57 PM

Awesome! it works like a charm.. Thanks!