Export Excel GridTemplateColumn + RadComboBox

4 posts, 0 answers
  1. Lasly
    Lasly avatar
    115 posts
    Member since:
    Nov 2009

    Posted 12 Mar 2012 Link to this post

    Hi ,
    When I Export to Excel from a  RadGrid then everything is fine, but if I Export RadGrid with GridTemplateColumn and RadComboBox as an  ItemTemplate, then the Value, DataValueField  ,of the RadComboBox  it show instead of the DataTextField.
    How can extract the radcombox  DataTextField instead of  DataValueField  ?
    thanks

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 Mar 2012 Link to this post

    Hello,

    Try the following.
    ASPX:

    <telerik:RadGrid ID="radgrid1" runat="server" DataSourceID="SqlDataSource1">
      <ExportSettings ExportOnlyData="false" Excel-Format="Html">
      </ExportSettings>
      <MasterTableView CommandItemDisplay="Top">
        <CommandItemSettings ShowExportToExcelButton="true" />
        <Columns>
          <telerik:GridTemplateColumn HeaderText="test">
            <ItemTemplate>
              <telerik:RadComboBox ID="RadComboBox1" runat="server" DataSourceID="SqlDataSource1" DataTextField="LastName" DataValueField="EmployeeID">
              </telerik:RadComboBox>
            </ItemTemplate>
          </telerik:GridTemplateColumn>
        </Columns>
      </MasterTableView>
    </telerik:RadGrid>

    Thanks,
    Princy.

  3. DevCraft Release
  4. Lasly
    Lasly avatar
    115 posts
    Member since:
    Nov 2009

    Posted 13 Mar 2012 Link to this post

    Many thanks for your answer, but does not work:
     1) export the DataTextField, but of all the items of radcombobox
     2) export the combo box and the select button. (+ All the buttons, because ExportOnlyData = "false")

    does it work for You?

    How do i solve this? ( I have so many pages with this problem)

     


    thank you very much

  5. Daniel
    Admin
    Daniel avatar
    4778 posts
    Member since:
    Sep 2012

    Posted 16 Mar 2012 Link to this post

    Hi Lasly,

    I created a simple demo based on the code posted by Princy. Please test it locally and see if it helps.

    Regards,
    Daniel
    the Telerik team

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.

Back to Top