FineUI 官方论坛
标题: Grid单元格编辑DropDown,选择后显示值问题 [打印本页]
作者: 渔歌 时间: 2014-5-27 08:57
标题: Grid单元格编辑DropDown,选择后显示值问题
1.使用FineUI在线示例代码,改造grid_editor_cell_databind页面。前台代码:
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="true" Title="表格" Width="850px" Height="350px"
runat="server" DataKeyNames="Id,Name" AllowCellEditing="true" ClicksToEdit="1">
<Columns>
<f:TemplateField Width="60px">
<ItemTemplate>
<aspabel ID="Label1" runat="server" Text='<%# Container.DataItemIndex + 1 %>'></aspabel>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="100px" ColumnID="Name" DataField="Name" FieldType="String"
HeaderText="姓名">
<Editor>
<f:TextBox ID="tbxEditorName" Required="true" runat="server">
</f:TextBox>
</Editor>
</f:RenderField>
<f:RenderField Width="100px" ColumnID="Gender" DataField="Gender" FieldType="String"
RendererFunction="renderGender" HeaderText="性别">
<Editor>
<fropDownList ID="ddlGender" Required="true" runat="server">
<fistItem Text="男" Value="1" />
<fistItem Text="女" Value="0" />
</fropDownList>
</Editor>
</f:RenderField>
<f:RenderField Width="100px" ColumnID="EntranceYear" DataField="EntranceYear" FieldType="Int"
HeaderText="入学年份">
<Editor>
<f:NumberBox ID="tbxEditorEntranceYear" NoDecimal="true" NoNegative="true" MinValue="2000"
MaxValue="2010" runat="server">
</f:NumberBox>
</Editor>
</f:RenderField>
<f:RenderField Width="100px" ColumnID="EntranceDate" DataField="EntranceDate" FieldType="Date"
Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="入学日期">
<Editor>
<fatePicker ID="DatePicker1" Required="true" runat="server">
</fatePicker>
</Editor>
</f:RenderField>
<f:RenderCheckField Width="100px" ColumnID="AtSchool" DataField="AtSchool" HeaderText="是否在校" />
<f:RenderField ExpandUnusedSpace="true" ColumnID="Major" DataField="Major" FieldType="String"
HeaderText="所学专业">
<Editor>
<fropDownList ID="ddlMajor" Required="true" runat="server">
</fropDownList>
</Editor>
</f:RenderField>
</Columns>
</f:Grid>
2.将后台绑定的DropDown绑定的方法修正为:
List<Majors> majors = new List<Majors>();
majors.Add(new Majors() { Code = "01", College = "材料科学与工程系" });
majors.Add(new Majors() { Code = "02", College = "化学系" });
majors.Add(new Majors() { Code = "03", College = "数学系" });
majors.Add(new Majors() { Code = "04", College = "物理系" });
majors.Add(new Majors() { Code = "05", College = "计算机科学与工程系" });
ddlMajor.DataTextField = "College";
ddlMajor.DataValueField = "Code";
ddlMajor.DataSource = majors;
ddlMajor.DataBind();
其中Majors对象为:
public class Majors
{
public String Code { get; set; }
public String College { get; set; }
}
3.绑定好之后进行页面选择,结果将01、02、03等Code显示在UI上。效果如截图。
作者: leetle 时间: 2014-5-27 13:06
什么问题,描述一下
作者: 渔歌 时间: 2014-5-27 17:04
你看截图
DropDown选择后,显示的值居然是DataValueField的值而不是DataTextField的值
这样就是BUG了,显示错误。
作者: 渔歌 时间: 2014-5-31 12:12
没人管?
欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/) |
Powered by Discuz! X3.4 |