EXT.NET Accessing ComboBox value at server DirectEvent

此生再无相见时 提交于 2019-12-24 16:18:40

问题


I have Ext.Net MVC form that post values to DirectAction. On server side, In DirectAction CoboBox selected value is always null.

public ActionResult Save()
{
var cmbSender = this.GetCmp<ComboBox>("cmbSender");
var senderID = cmbSender.SelectedItem.Value;
}

I have checked

Request["cmbSender"]

but it does not work

<form id="form12">
@(
X.TabPanel()
    .Items(
        X.FormPanel()
        .Title("New Job")
        .ID("pnlNewJob")
        .Layout(LayoutType.Form)
        .MarginSpec("5 5 5 5")
        .Items(

X.Panel()
                                    .Border(false)
                                    .ColumnWidth(0.4)
                                    .Layout(LayoutType.Form)
                                    .Items(
                                        Html.X().ComboBox()
                                        .ID("cmbSender")
                                        .DisplayField("Code")
                                        .ValueField("ID")
                                        .EmptyText("Code")
)
</form>

回答1:


You can use X.FormPanel()'s .Buttons() to post your form data. Add your ComboBox selected value Button's DirectEvent. An example :

.Buttons( Html.X().Button() .Text(AppTexts.Save) .Icon(Icon.Accept) .ID("SaveButton") .DirectEvents(de => { de.Click.Url = Url.Action("Save"); de.Click.ExtraParams.Add( new Parameter { Name = "cmbSelectedValue", Value ="App.cmbSender.getValue()", Mode = ParameterMode.Raw } ); }) )



来源:https://stackoverflow.com/questions/21043153/ext-net-accessing-combobox-value-at-server-directevent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!