This is a migrated thread and some comments may be shown as answers.

Grid Toolbar with the Excel Export and Custom Dropdownlist

1 Answer 645 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 04 Feb 2015, 08:31 PM
How do you add a DropDownlist to Grid Toolbar that is already showing the built in Excel toolbar button.

@(Html.Kendo().Grid<Reports.ReportRow>()
    .Name("grdReport")
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read
                .Action("AJAX", "Report")
                .Data("GetReportParms")
        )
    )
    .ToolBar(tools => {
        tools.Excel();
        tools.Template(@<text>
           <div class="toolbar">
                <label class="category-label" for="category">Version:</label>
                    @(Html.Kendo().DropDownList()
                        .Name("ddlField")
                        .DataTextField("Text")
                        .DataValueField("Value")
                        .AutoBind(true)
                        .Events(e => e.Change("fieldChange"))
                        .DataSource(ds =>
                        {
                            ds.Read("FieldType", "Common");
                        })
                    )
            </div>
        </text>);
    })

All the examples I can find show either a DropDownList in a Toolbar Template OR the built in Excel toolbar button.  I need both.

Thanks

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 05 Feb 2015, 05:06 PM

Hello Jon,

The built in commands and the template cannot be used together in the configuration as the template will override them. The solution is to directly include the command mark up in the template. In the current case it would be

<a class="k-button k-button-icontext k-grid-excel" href="#"><span class="k-icon k-i-excel"></span>Export to Excel</a>

I wish you a great day!

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Jon
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or