Книга: C# 2008 Programmer
Making the Publisher Field Editable
Making the Publisher Field Editable
Now select a record, and click the Edit link. Notice that the publisher is not editable (see Figure 17-21).
Figure 17-21
Here's how to make the publisher field editable. In the source view of Default.aspx
, insert the following highlighted code:
<asp:TemplateField HeaderText="Publisher">
<ItemTemplate>
<%#Eval("publisher.pub_name")%>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList
DataSourceID="LinqDataSource2"
DataTextField="pub_name"
DataValueField="pub_id"
SelectedValue='<%#Bind("pub_id")%>'
runat="server">
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
This creates a dropdown list within the GridView
control (under the Publisher
column) and displays a list of publishers available.
Press F5 to debug the application again. A title's publisher can now be changed (see Figure 17-22).
Figure 17-22
- Displaying Titles from a Selected Publisher
- 4.4.4 The Dispatcher
- About the author
- Chapter 7. The state machine
- Appendix E. Other resources and links
- Example NAT machine in theory
- The final stage of our NAT machine
- Compiling the user-land applications
- The conntrack entries
- Untracked connections and the raw table
- Basics of the iptables command
- Other debugging tools