Search code examples
asp.netdynamic-data

ASP.NET Dynamic-data: Hot to add editable text column to readonly grid view


For displaying data in our application I've use GridView with the following markup:

<asp:GridView ID="listGridView" runat="server" DataSourceID="GridDataSource" 
AllowPaging="True" AllowSorting="True"CssClass="gridview" AutoGenerateColumns="false" >
<Columns>
<asp:DynamicField DataField="App_Contact" />
<asp:DynamicField DataField="OldContact" />
<asp:DynamicField DataField="OldContactType" />
<asp:DynamicField DataField="NewContact" />
<asp:DynamicField DataField="NewContactType" />
<asp:DynamicField DataField="action_id" />
</Columns>
</asp:GridView>

Control with above grid is used as List control and display data in read only mode. I would like add text box for each row and button for text box values saving. I've create dynamic filed control (inherited from FieldTemplateUserControl), but control always invoked in readonly mode and property Mode always equal Read and control does not save data in databound source. May be is exists any another way to add editable column to dynamic data List control?


Solution

  • The IDataBoundControl, IDataBoundListControl, IDataBoundItemControl and the IFieldControl interfaces expose the common properties that are required for Dynamic Data support. If you are creating a custom data-bound control that will work with Dynamic Data, you can implement these interfaces instead of deriving from the DataBoundControl class.