ASP.NET 中DataGrid item 绑定方法

时间:2024-01-11 22:31:32
 <Columns>
<asp:TemplateColumn HeaderImageUrl="../../Images/delete.GIF">
<HeaderStyle Wrap="False" Width="20px"></HeaderStyle>
<ItemTemplate>
<asp:CheckBox runat="server" ID="cbxDelete"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="工作区段名称" SortExpression="Name">
<HeaderStyle Width="200px"></HeaderStyle>
<ItemTemplate>
<a href='SectionSave.aspx?id=<%# DataBinder.Eval(Container, "DataItem.ID")%>&ReadOnly'>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.Name")%>'
ID="lblSection" />
</a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="区间站场" SortExpression="IntervalStation_ID">
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemTemplate>
<asp:Label runat="server" Text='<%# GetIntervalStationName( DataBinder.Eval(Container, "DataItem.IntervalStation_ID") ) %>'
ID="lblIntervalStationName">
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="UnitName" HeaderText="工区" SortExpression="UintID"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="编辑">
<HeaderStyle Wrap="False" HorizontalAlign="Center" Width="40px"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<cc2:FImageButton ID="btnEdit" runat="server" CommandName="Edit" ImageUrl="../../Images/edititem.GIF"
FunctionID="Section/Modify" ToolTip="编辑"></cc2:FImageButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>