本帖最后由 六月雪 于 2012-3-13 21:00 编辑
不绑定字段,可以在aspx文件中实现窗口列和模板列在每一行的后面(如上图),代码如下:
<Columns>
<ext:BoundField Width="100px" SortField="年" DataField="年" DataFormatString="{0}" HeaderText="年" />
<ext:BoundField Width="60px" DataField="月" HeaderText="月" />
<ext:BoundField Width="60px" DataField="日" HeaderText="日" />
<ext:BoundField Width="100px" SortField="温度" DataField="温度" DataFormatString="{0}" HeaderText="温度" />
<ext:CheckBoxField Width="60px" RenderAsStaticField="true" DataField="有效" HeaderText="有效" />
<ext:WindowField ColumnID="myWindowField" Width="60px" WindowID="Window111" HeaderText="窗口列"
Icon="TableEdit" ToolTip="编辑" DataTextFormatString="{0}" DataIFrameUrlFields="Id"
DataIFrameUrlFormatString="grid_iframe_window.aspx?id={0}" DataWindowTitleField="温度"
DataWindowTitleFormatString="编辑 - {0}" />
<ext:TemplateField HeaderText="模板列">
<ItemTemplate>
<a href="<%# GetEditUrl(DataBinder.Eval(Container.DataItem, "Id"), DataBinder.Eval(Container.DataItem, "温度")) %>">
编辑</a>
</ItemTemplate>
</ext:TemplateField>
</Columns>
如果在aspx.cs文件中动态绑定字段,则窗口列和模板列全部显示在前面。
<Columns>
<ext:WindowField ColumnID="myWindowField" Width="60px" WindowID="Window111" HeaderText="窗口列"
Icon="TableEdit" ToolTip="编辑" DataTextFormatString="{0}" DataIFrameUrlFields="Id"
DataIFrameUrlFormatString="grid_iframe_window.aspx?id={0}" DataWindowTitleField="温度"
DataWindowTitleFormatString="编辑 - {0}" />
<ext:TemplateField HeaderText="模板列">
<ItemTemplate>
<a href="<%# GetEditUrl(DataBinder.Eval(Container.DataItem, "Id"), DataBinder.Eval(Container.DataItem, "温度")) %>">
编辑</a>
</ItemTemplate>
</ext:TemplateField>
</Columns>
在init中运行如下代码:
Dim bf As ExtAspNet.BoundField
bf = New ExtAspNet.BoundField()
bf.DataField = "年"
bf.DataFormatString = "{0}"
bf.HeaderText = "年"
Grid1.Columns.Add(bf)
bf = New ExtAspNet.BoundField()
bf.DataField = "月"
bf.DataFormatString = "{0}"
bf.HeaderText = "月"
Grid1.Columns.Add(bf)
bf = New ExtAspNet.BoundField()
bf.DataField = "日"
bf.DataFormatString = "{0}"
bf.HeaderText = "日"
Grid1.Columns.Add(bf)
bf = New ExtAspNet.BoundField()
bf.DataField = "有效"
bf.DataFormatString = "{0}"
bf.HeaderText = "有效"
Grid1.Columns.Add(bf)
通过程序如何使窗口列和模板列还是放在行的后面,另外cs程序中可以动态绑定窗口列和模板列吗?
|