午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    ASP.Net中數(shù)據(jù)展示控件的嵌套使用示例
    來源:易賢網(wǎng) 閱讀:660 次 日期:2014-10-13 09:27:30
    溫馨提示:易賢網(wǎng)小編為您整理了“ASP.Net中數(shù)據(jù)展示控件的嵌套使用示例”,方便廣大網(wǎng)友查閱!

    1,工作中遇到這樣一個(gè)需求,頁面上要把所有的User加載出來,同時(shí)每個(gè)User后面緊跟著要把User的任務(wù)加載出來!我的處理方法是用Repeater來加載所有的User,同時(shí)在Repeater里面嵌套一個(gè)GridView,將每個(gè)User的任務(wù)展示出來!代碼如下

    前臺代碼:

    <asp:Repeater ID="Repeater1" runat="server"

    onitemdatabound="Repeater1_ItemDataBound">

    <HeaderTemplate>

    <table border="0" cellspacing="0" cellpadding="0" width="100%">

    <tr>

    </HeaderTemplate>

    <ItemTemplate>

    <td class="list_table_in">

    <span class="leaderTitle">高管:<a href='/LeaderSchedule/_layouts/LS/LeaderDetail.aspx?loginName=<%#Eval("LoginName") %>'><%#Eval("UserName") %></a></span><asp:GridView ID="gv_InRep" runat="server" AutoGenerateColumns="False" AllowSorting="True"

    OnRowCreated="GV_DoneList_RowCreated" OnSorting="GV_DoneList_Sorting" AllowPaging="True"

    CssClass="tasklisttbl" Width="100%" OnRowDataBound="GV_DoneList_RowDataBound"

    EnableModelValidation="True">

    <AlternatingRowStyle BackColor="#FDFEFF" />

    <HeaderStyle HorizontalAlign="Center" ForeColor="Black" Height="20" />

    <RowStyle HorizontalAlign="Center" Height="26px" />

    <Columns>

    <asp:BoundField HeaderText="日期" ItemStyle-CssClass="custom" DataField="Date" SortExpression="Date">

    <ItemStyle Width="15%" />

    </asp:BoundField>

    <asp:BoundField HeaderText="時(shí)間" DataField="Time" SortExpression="Time">

    <ItemStyle Width="11%" />

    </asp:BoundField>

    <asp:BoundField HeaderText="工作安排" DataField="WorkPlan" SortExpression="WorkPlan">

    <ItemStyle Width="11%" />

    </asp:BoundField>

    <asp:BoundField HeaderText="地點(diǎn)" DataField="Place" SortExpression="Place">

    <ItemStyle Width="11%" />

    </asp:BoundField>

    </Columns>

    <PagerTemplate>

    </PagerTemplate>

    </asp:GridView>

    </td>

    <asp:Literal ID="Literal1" runat="server" Text='<%#Eval("Flag") %>'></asp:Literal>

    </ItemTemplate>

    <FooterTemplate>

    </tr></table>

    </FooterTemplate>

    </asp:Repeater>

    后臺代碼:

    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)

    {

    try

    {

    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)

    {

    GridView gv = e.Item.FindControl("gv_InRep") as GridView;//找到里層的repeater對象

    Leader rowv = (Leader)e.Item.DataItem;//找到分類Repeater關(guān)聯(lián)的數(shù)據(jù)項(xiàng)

    string typeid = rowv.LoginName; //獲取填充子類的id

    SetSorting();

    gv.DataSource = PointDataSource(typeid);

    gv.DataBind();

    }

    }

    catch (Exception ex)

    {

    SysLog syslog = new SysLog();

    syslog.ListName = ConstData.ListName_PCITC_LS_Schedule;

    syslog.LType = "Repeater的Item綁定事件異常";

    syslog.WorkFlowName = "領(lǐng)導(dǎo)日程管理系統(tǒng)";

    syslog.Location = "Repeater綁定數(shù)據(jù):OtherSchedule.aspx";

    syslog.Message = "頁面信息加載異常:" + ex.Message;

    syslog.DataSource = 0;

    logprovider.AddAuditRecordToSource(syslog);

    }

    }

    更多信息請查看IT技術(shù)專欄

    更多信息請查看網(wǎng)絡(luò)編程
    易賢網(wǎng)手機(jī)網(wǎng)站地址:ASP.Net中數(shù)據(jù)展示控件的嵌套使用示例
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2025國考·省考課程試聽報(bào)名

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)