【发布时间】:2011-10-31 09:41:07
【问题描述】:
在 List.aspx 页面上,我自定义了带有名称的列。我已经自动生成了删除、编辑和选择按钮为真。但是,当 GridView 处于行编辑模式时,在一个字段 CA_AgencyAcronym 字段上,我希望将该字段作为下拉列表而不是现在的文本框。我该如何做到这一点?我已经在我的字段模板目录中创建了自定义用户控件。
<asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true"
AllowPaging="True" AllowSorting="True" CssClass="DDGridView"
RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6" AutoGenerateColumns="false" AutoGenerateEditButton="true" AutoGenerateSelectButton="true" AutoGenerateDeleteButton="true">
<Columns>
<asp:DynamicField DataField="CA_AgencyName" HeaderText="Agency Name" />
<asp:DynamicField DataField="CA_AgencyAcronym" HeaderText="Official Acronym"/>
<asp:DynamicField DataField="CA_AgencyAcronym_SOLID" HeaderText="SOLID Acronym"/>
<asp:DynamicField DataField="CA_AgencyHomePageURL" UIHint="Url" HeaderText="Web Address"/>
<asp:DynamicField DataField="CA_AgencyContact" HeaderText="Email/Contact Page"/>
<asp:DynamicField DataField="CA_AgencyCredentialType" HeaderText="Credential Type"/>
<asp:DynamicField DataField="CA_AgencyStreetAddress1" HeaderText="Address"/>
<asp:DynamicField DataField="CA_AgencyStreetAddress2" HeaderText="Address Cont."/>
<asp:DynamicField DataField="CA_AgencyCity" HeaderText="City"/>
<asp:DynamicField DataField="CA_AgencyState" HeaderText="State"/>
<asp:DynamicField DataField="CA_AgencyZip" HeaderText="Zip"/>
<asp:DynamicField DataField="CA_AgencyCountry" HeaderText="Country" />
<asp:DynamicField DataField="CA_AgencyPhonePrimary" HeaderText="Primary Phone"/>
<asp:DynamicField DataField="CA_AgencyPhonePrimaryExtension" HeaderText="Primary Extension"/>
<asp:DynamicField DataField="CA_AgencyPhoneSecondary" HeaderText="Secondary Phone"/>
<asp:DynamicField DataField="CA_AgencyRecordAddedUserID" HeaderText="Added By"/>
<asp:DynamicField DataField="CA_AgencyRecordUpdatedDate" HeaderText="Date Changed"/>
<asp:DynamicField DataField="CA_AgencyRecordUpdatedUserID" HeaderText="Changed By"/>
<asp:DynamicField DataField="DOL_ORG_ID" HeaderText="DOL ORG ID"/>
</Columns>
<PagerStyle CssClass="DDFooter"/>
<PagerTemplate>
<asp:GridViewPager runat="server" />
</PagerTemplate>
<EmptyDataTemplate>
There are currently no items in this table.
</EmptyDataTemplate>
</asp:GridView>
【问题讨论】:
标签: asp.net gridview dynamic-data