asp.net网站前台通过DataList展示信息的代码

让人想犯罪 __ 提交于 2020-03-16 11:02:41

//aspx页面中

<asp:DataList ID="dlZP" runat="server" CssClass="hong">
                                            <ItemTemplate>
                                                <table align="center" cellpadding="0" cellspacing="0" width="266">
                                                    <tr>
                                                        <td>
                                                            <span class="hong" style="color: #000000">·<a class="huise" href="#"
             onClick="window.open('ShowLeaguerInfo.aspx?id=<%#DataBinder.Eval(Container.DataItem,"id") %>','','height=258, width=479, top=200, left=200')"><%#DataBinder.Eval(Container.DataItem,"title") %></a></span></td>
                                                    </tr>
                                                    <tr style="color: #000000">
                                                        <td>
                                                            <img height="1" src="images/line.gif" width="266" /></td>
                                                    </tr>
                                                </table>
                                            </ItemTemplate>
                                        </asp:DataList>

//cs文件中

 if (!IsPostBack)  //!IsPostBack避免重复刷新加载页面
        {
            //获取前6条分类供求信息
            dlZP.DataSource = operation.SelectLeaguerInfo(true, "公司公告", 6);//dlZP与前台的id相同
            dlZP.DataBind();
         }

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!