2011-10-31 30 views
0

在List.aspx頁面上,我定製了名稱列。我有自動生成的刪除,編輯和選擇按鈕爲true。但是,在GridView處於行編輯模式時,在一個字段中的CA_AgencyAcronym字段我想將該字段作爲Dropdownlist而不是現在的文本框。我該如何做到這一點?我已經在我的字段模板目錄中創建了自定義用戶控件。當我的動態數據站點中的Gridview控件處於編輯模式時,如何更改特定字段中的控件?

<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> 

回答

1

您可以自定義GridView的EditItemTemplate,並將dropDown控件替換爲默認的文本框。嘗試在GridView上點擊右鍵,然後選擇編輯模板...

相關問題