locked
How do I change the Control in a Specific field when the Gridview Control is in edit mode in my Dynamic Data site? RRS feed

  • Question

  • User943994099 posted

    On the List.aspx page I have customized the columns with names. And I have auto generated the delete, edit, and select buttons to true. However on one of my column fields when the GridView is in in line edit mode I want to have that field as a Dropdownlist instead of a text box as it is now. How do I accomplish this? I have already created the custom user control in my field templates directory.

    Monday, October 31, 2011 1:04 PM

Answers

  • User-330204900 posted

    Hi mojaray2k, I would create a custom field template ans specify it in your metadata classes using UIHint.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 1, 2011 8:44 AM

All replies

  • User-1528094326 posted

    The column will have to be <asp:TemplateColumn> and then you will need to use the <ItemTemplate> inside of that to have a label or other item displaying data and then in the <EditTemplate> you can specify the drop down list and bind it accordingly.

    Monday, October 31, 2011 1:12 PM
  • User943994099 posted
    Here is my Gridview control at the bottom. I cannot insert a <asp:TemplateColumn> in it. I want the Credential Type field to be a dropdown list when I click on the edit button.

    <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true" AllowPaging="True" AllowSorting="True" CssClass="DDGridView" RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" AutoGenerateSelectButton="True"> <Columns> <%--<asp:TemplateField> <ItemTemplate> <asp:DynamicHyperLink runat="server" Action="Edit" Text="Edit" />&nbsp;<asp:LinkButton runat="server" CommandName="Delete" Text="Delete" OnClientClick='return confirm("Are you sure you want to delete this item?");' />&nbsp;<asp:DynamicHyperLink runat="server" Text="Details" /> </ItemTemplate> </asp:TemplateField>--%> <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" HeaderText="Web Address" /> <asp:DynamicField DataField="CA_AgencyContact" HeaderText="Email/Contact Page" /> <asp:DynamicField DataField="CA_AgencyCredentialType" HeaderText="Credential Type" /> <asp:DynamicField DataField="CA_AgencyCredentialType" HeaderText="Credential Type" UIHint="ForeignKey_Edit" /> <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_AgencyPhoneSecondary" HeaderText="Secondary Phone" /> <asp:DynamicField DataField="CA_AgencyFax" HeaderText="Fax" /> <asp:DynamicField DataField="CA_AgencyRecordAddedDate" HeaderText="Date Added" /> <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="Dept. of Labor Org ID" /> </Columns> <PagerStyle CssClass="DDFooter"/> <PagerTemplate> <asp:GridViewPager runat="server" /> </PagerTemplate> <EmptyDataTemplate> There are currently no items in this table. </EmptyDataTemplate> </asp:GridView>
    Tuesday, November 1, 2011 12:58 AM
  • User-330204900 posted

    Hi mojaray2k, I would create a custom field template ans specify it in your metadata classes using UIHint.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 1, 2011 8:44 AM