asp.net 前台 对列进行加工(用DataBinder.Eval 不要用Bind)

本文详细介绍了如何在ASP.NET应用中利用模板字段自定义稿件的显示方式,包括编辑视图模板的实现及样式调整,以及如何在项模板中通过服务器变量动态展示稿件信息,如远程路径、小图片文件名等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 <asp:TemplateField HeaderText="稿件">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("[sServerVirtualityPathHttpRemote,sOppositePath,sSmallPhotoFileName]") %>'></asp:TextBox>
                                                </EditItemTemplate>
                                                <ItemStyle Font-Size="9pt" Width="8%" HorizontalAlign="Center" VerticalAlign="Middle" />
                                                <HeaderStyle Font-Size="9pt" Width="8%" HorizontalAlign="Center" VerticalAlign="Middle" />
                                                <ItemTemplate>
                                                    <table style="margin-top: 0px; margin-left: 0px">
                                                        <tr>
                                                            <td style="height: 58px">
                                                                <a href='<%# string.Format( "PhotoInformation.aspx?ImageID={0}&sType={1}&sImage=1", DataBinder.Eval(Container.DataItem, "sGuidID"),DataBinder.Eval(Container.DataItem, "sGuidIDtBaseDraftType")) %>'
                                                                    target="_blank">
                                                                    <asp:Image ID="Image1" runat="server" ImageUrl='<%# string.Format("{0}/{1}/small/{2}",DataBinder.Eval(Container.DataItem, "sServerVirtualityPathHttpRemote"),DataBinder.Eval(Container.DataItem, "sOppositePath"),DataBinder.Eval(Container.DataItem, "sSmallPhotoFileName")) %>'
                                                                        Height="53px" Width="60px" /><asp:HyperLink ID="HyperLink_txt" runat="server" Visible="False"
                                                                            Target="_blank">HyperLink</asp:HyperLink></td>
                                                        </tr>
                                                    </table>
                                                </ItemTemplate>
                                            </asp:TemplateField>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值