I have a method that returns a ActionResult
called through a Html.Action()
directly on View
using Razor
.
This method is used to render a ComboBox
of devExpress
with the data that I send from a SQL
command at the view
opening, where it takes a lot of time to load combobox
since for every 1 it should go in the bank and bring the data of the past command.
Problem
I want to exchange this call through Html.Action()
to javascript
so that it loads the combobox
data in the click event of the component, so I do not lose the loading time of view
and load only when the user is actually using / clicking.
View:
@Html.Action("ComboBoxDataFilter", "SearchComboBox", new
{
controlName = "ComboBoxFILIAL",
sql = "SELECT CODFIL, TAG, RAZSOC FROM FILIAL",
fkField = "CODFIL",
fields = "TAG, RAZSOC",
descriptionFields = "Código, Razão Social",
widthColumns = "30%,70%",
width = "100%",
showFormatString = true,
showAdvancedFilter = false,
showStandardFilter = false,
showDropDownButton = true,
inputHidden = "CODFIL",
filter = "",
eventSelectedIndexChanged = "function(s, e) { $('#CODFIL').val(ComboBoxFILIAL.GetValue()); onCodFilChange(); }",
eventBeginCallback = "",
filterfield = "RAZSOC",
value = (Model == null || Model.CODFIL == null) ? 0 : Model.CODFIL
})
public ActionResult ComboBoxDataFilter(string controlName, string sql, string fkField, string customFkField, string fields, string filter, string eventSelectedIndexChanged, string eventValueChanged, string eventBeginCallback, string eventEndCallback, string value, string sqlValue, string filterfield, string descriptionFields, string fkTable, string compositeFk, string displayFields, string inputHidden, string width, string widthColumns, bool showAdvancedFilter, bool showStandardFilter, bool showDropDownButton, bool showFormatString, string valueType, bool readOnly, string view, Dictionary<string, object> parametros, bool showCleanButton = true)
{
var model;
return PartialView("SearchComboBoxFilter", model);
}