哪个事件可以访问转发器中的所有元素 [英] Which event to access all the elements in repeater

查看:71
本文介绍了哪个事件可以访问转发器中的所有元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似下面的转发器

I have a repeater like below

<asp:Repeater    ID="Repeater_LogReportingSessionList" runat="server" OnItemCommand="Repeater_LogReportingSessionList_ItemCommand" OnItemDataBound="Repeater_LogReportingSessionList_ItemDataBound" >

        <HeaderTemplate>
            <table border="0" width="100%" cellpadding="0" cellspacing="0" id="item-table">
                <tr>
                    <%-- <th class="table-header-first">
            <a>Id</a>
          </th>--%>
                    <th class="table-header-repeat line-left">
                        <a>Product Type</a>
                    </th>
                    <th class="table-header-repeat line-left">
                        <a>Serial Number</a>
                    </th>
                    <th class="table-header-repeat line-left">
                        <a>Create Time</a>
                    </th>
                    
                    <th class="table-header-last line-left">
                        <a>Log File</a>
                    </th>
                </tr>
        </HeaderTemplate>

        <AlternatingItemTemplate>
            <tr class="alternate-row">
               
                <td><%#Eval("ProductType")%></td>
                <td><%#Eval("SerialNumber")%></td>
                <td><%#Eval("CreateTime")%></td>
               <td>
               <eo:Downloader runat="server" ID ="Downloader1" AutoHideDownloadButton="false" DownloadButtonID="btn_Download" FilePath="D:\L32.txt"></eo:Downloader>
                 <asp:LinkButton ID="btn_Download" CssClass="icon-download info-tooltip" runat="server" />
                 <asp:Label ID="Label1" Text="The file is no longer available" Visible="false" runat="server" />
                   </td>
            </tr>
        </AlternatingItemTemplate>

        <ItemTemplate>
            <tr>

                <td><%#Eval("ProductType")%></td>
                <td><%#Eval("SerialNumber")%></td>
                <td><%#Eval("CreateTime")%></td>
                <td>
                    <eo:Downloader runat="server" ID ="Downloader1" AutoHideDownloadButton="false" DownloadButtonID="btn_Download" FilePath="D:\L31.txt"></eo:Downloader>
                    <asp:LinkButton ID="btn_Download" CssClass="icon-download info-tooltip" runat="server" />
                    <asp:Label ID="lblNoExist" Text="The file is no longer available" Visible="false" runat="server" />
                </td>
            </tr>
        </ItemTemplate>

        <FooterTemplate>
            <table border="0" width="100%" cellpadding="0" cellspacing="0" id="item-table">
                <tr>
                    <td class="table-header-first" style="width: 300px">
                        <a>All Products</a>
                    </td>
                    <td class="table-header-repeat line-left">
                        <a>Serial Number</a>
                    </td>
                    <td class="table-header-repeat line-left">
                        <a>Create Time</a>
                    </td>
                    <td class="table-header-first" style="width: 300px">
                        <a>Log Files</a>

                    </td>
                    <td>
                       <eo:Downloader runat="server" ID ="Downloader2" AutoHideDownloadButton="false" DownloadButtonID="btn_AllDownload" FilePath="D:\TuneInMediaFiles\bo2.zip"></eo:Downloader>
                        <asp:LinkButton ID="btn_AllDownload" CssClass="icon-download info-tooltip" runat="server" />
                    </td>
                </tr>
            </table>
            </table> 
        </FooterTemplate>

    </asp:Repeater>





我有一个包含下载按钮的列。最后一行应该是有一个按钮,它将读取该列中的所有文件并压缩它。



我尝试过:



现在正好像我这样做

protec ted void Repeater_LogReportingSessionList_ItemDataBound(object sender,RepeaterItemEventArgs e)

{

}



但这个方法被调用所有项目。所以,我能够读取所有文件和zip。

你能告诉我应该用哪种方法。我必须在渲染转发器之前设置下载程序文件路径属性。



I have a column having the download button.Last row should be having a button which will read all the files in that column and zip it.

What I have tried:

For now being i am doing like this
protected void Repeater_LogReportingSessionList_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
}

but this method is called for all the items. So, im anot able to read all files and zip.
Can you tell me which method i should do. I have to set the downloader file path property before rendering the repeater.

推荐答案

ItemDataBound事件将起作用。只需检查您是否在最后一条记录中。或者,PreRender事件可能适用于您正在做的事情。以下是所有活动:转发器事件(系统) .Web.UI.WebControls) [ ^ ]
The ItemDataBound event will work. Just check to see if you are on the last record. Or, the PreRender event might work for what you are doing. Here are all events: Repeater Events (System.Web.UI.WebControls)[^]


这篇关于哪个事件可以访问转发器中的所有元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆