FineUI 官方论坛
标题:
下拉列表选中项改变form表单控件
[打印本页]
作者:
zby-2580
时间:
2019-4-18 17:42
标题:
下拉列表选中项改变form表单控件
有一个下拉列表,一个form,form中只有一个控件,下拉列表中的选项对应不同的控件(录入框),这个怎么写,controller里怎么往回发,请指教,谢谢!
作者:
sanshi
时间:
2019-4-19 10:13
单纯的文字无法准确表达代码的意图。请在空项目中重现问题,并上传。
作者:
zby-2580
时间:
2019-4-23 16:00
前端页面:
F.Panel().ShowBorder(false).ShowHeader(false).ID("panelTop").Layout(LayoutType.HBox).Items(
F.DropDownList().ID("PointSelect").DataTextField("Value").DataValueField("Key").Width(120).DataSource(ViewBag.ddlPoint),
F.DropDownList().ID("Record").Required(true).DataTextField("Value").DataValueField("Key").AutoSelectFirstItem(false).EmptyText("点击选择记载项")
.OnSelectedIndexChanged(Url.Action("DoSearchPaging"), "DataEnterGrid", new Parameter("Layout_detailId", "F.ui.Layout_detailId.getText().replace(/<[^>]+>/g, '')"),new Parameter("recordId", "F.ui.Record.getValue()"))
.Width(150).MarginLeft(5).DataSource(ViewBag.recordName),
F.Form().ID("diffInputForm").Width(150).MarginLeft(5).Layout(LayoutType.Fit).ShowBorder(false).ShowHeader(false).Items(ViewBag.DiffInput),
Controller:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult DoSearchPaging(FormCollection values, long? Layout_detailId, long? recordId)
{
DoPageRefresh(values, Layout_detailId, recordId);
return UIHelper.Result();
}
public void DoPageRefresh(FormCollection values, long? Layout_detailId, long? recordId)
{
Pager pagerDatas = new Pager(values.GetFineUIGridPageIndex("DataEnterGrid") + 1, AppSettingsUtility.DefaultGridPageSize);
var datasDatas = bll.GetListByPager<R_recordvalueEntity>(pagerDatas, a => a.RecordId == recordId && a.LayoutDetailId == Layout_detailId, PagerSortDirection.ASC, w => w.Id)
.Select(b => new { b.Id, b.Point, b.Value, b.RecordId, b.EnterDate, b.Images, b.Comments }).ToList();
List<FormInfoMode2> Form2 = new List<FormInfoMode2>();
for (var i = 0; i < datasDatas.Count(); i++)
{
FormInfoMode2 Form = new FormInfoMode2();
Form.Id = datasDatas
.Id;
Form.Point = datasDatas
.Point;
Form.Value = datasDatas
.Value;
Form.RecordId = datasDatas
.RecordId;
Form.EnterDate = datasDatas
.EnterDate;
Form.Images = datasDatas
.Images;
Form.Comments = datasDatas
.Comments;
Form.RecordName = bll.GetEntity<R_recordEntity>(w => w.id == datasDatas
.RecordId).record_name;
Form2.Add(Form);
}
var gridDatas = UIHelper.Grid("DataEnterGrid");
gridDatas.RecordCount(pagerDatas.RecordCount);
gridDatas.DataSource(Form2, values.GetFineUIGridFields("DataEnterGrid"));
//根据记载项类型添加不同的数据录入框
ViewBag.DiffInput = ChooseDiffTypeInput(recordId);
}
怎么才能给返回去?
欢迎光临 FineUI 官方论坛 (https://fineui.com/bbs/)
Powered by Discuz! X3.4