Asp. Example of nested use of data display controls in net

Source: Internet
Author: User
Tags eval syslog

1, work encountered such a demand, the page to all the user load out, while each user followed by the user's task to load out! My approach is to use repeater to load all the user, while in the repeater nested a GridView, the task of each user to display! The code is as follows

Foreground code:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 <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 "> Executive: <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"/>

Background code:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 The protected void Repeater1_itemdatabound (object sender, Re Peateritemeventargs e) {try {if (E.item.itemtype = = ListItemType.Item | | e.item.itemtype = = ListItemType.AlternatingItem {GridView GV = E.item.findcontrol ("Gv_inrep") as gridview;//finds the Repeater object in the inner layer Leader ROWV = (Leader) e.item.dataitem;//find The category repeater the associated data item   String typeid = Rowv. LoginName; Gets the id  setsorting () of the populated subclass; Gv. DataSource = Pointdatasource (typeid); Gv. DataBind ();   }    catch (Exception ex) {   syslog syslog = new Syslog (); syslog. ListName = Constdata.listname_pcitc_ls_schedule; Syslog. Ltype = "Repeater Item binding event exception"; Syslog. Workflowname = "Leadership Schedule management System"; Syslog. Location = "Repeater bound data: otherschedule.aspx"; Syslog. Message = "Page Information Loading exception:" + ex. message; Syslog. DataSource = 0; Logprovider. AddauditrecordtOsource (syslog); } }
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.