Nested use of data display controls in ASP. Net and asp.net

Source: Internet
Author: User

Nested use of data display controls in ASP. Net and asp.net

1. When you encounter such a requirement at work, you need to load all the users on the page, and each User is followed by the task of loading the User! My solution is to use Repeater to load all users and nest a GridView in Repeater to display the tasks of each User! The Code is as follows:

Front-end code:

<Asp: repeater ID = "Repeater1" runat = "server" onitemdatabound = "repeaterincluitemdatabound"> <HeaderTemplate> <table border = "0" cellspacing = "0" cellpadding = "0" width =" 100% "> <tr> </HeaderTemplate> <ItemTemplate> <td class =" list_table_in "> <span class =" leaderTitle "> senior executives: <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 = "inline" OnSorting = "inline" AllowPaging = "True" CssClass = "tasklisttbl "Width =" 100% "OnRowDataBound =" inline "EnableModelValidation =" True "> <AlternatingRowStyle BackColor =" # FDFEFF "/> <HeaderStyle HorizontalAlign =" Center "ForeColor =" Black "Height = "20"/> <RowStyle HorizontalAlign = "Center" Height = "26px"/> <Columns> <asp: boundField HeaderText = "Date" ItemStyle-CssClass = "custom" DataField = "Date" SortExpression = "Date"> <ItemStyle Width = "15%"/> </asp: boundField> <asp: BoundField HeaderText = "Time" DataField = "Time" SortExpression = "Time"> <ItemStyle Width = "11%"/> </asp: BoundField> <asp: boundField HeaderText = "Work Arrangement" DataField = "WorkPlan" SortExpression = "WorkPlan"> <ItemStyle Width = "11%"/> </asp: BoundField> <asp: boundField HeaderText = "location" DataField = "Place" SortExpression = "Place"> <ItemStyle Width = "11%"/> </asp: boundField> </Columns> <PagerTemplate> </asp: GridView> </td> <asp: literal ID = "Literal1" runat = "server" Text = '<% # Eval ("Flag") %>'> </asp: literal> </ItemTemplate> <FooterTemplate> </tr> </table> </FooterTemplate> </asp: Repeater>View Code

Background code:

Protected void repeaterincluitemdatabound (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; // find the repeater object Leader rowv = (Leader) e. item. dataItem; // find the data item string typeid = rowv associated with the category Repeater. loginName; // obtain the id SetSorting (); gv. dataSource = PointDataSource (typeid); gv. dataBind () ;}} catch (Exception ex) {SysLog syslog = new SysLog (); syslog. listName = ConstData. listName_PCITC_LS_Schedule; syslog. LType = "Item binding event exception of Repeater"; syslog. workFlowName = "lead schedule management system"; syslog. location = "Repeater: OtherSchedule. aspx "; syslog. message = "Page Information loading exception:" + ex. message; syslog. dataSource = 0; logprovider. addAuditRecordToSource (syslog );}}

 


How to Use the ASPNET user control nesting ()

Can't I write another one directly in the user control? Or configure it in webconing! Try writing!

How to implement data control nesting in aspnet? Code, thank you

This is what I wrote. I wrote it in the login interface!
I used this to compare user names and passwords for MyQQ projects;

If (user name = User Name Defined)
{
If (Password = defined secret)
{
The displayed Page name is the custom receiving Page name = The new Page name ();
Custom interface name. Show ();

}
Else
{
MessageBox. Show ("sorry, the information you entered is incorrect! "," Logon prompt ", MessageBoxButtons. OK, MessageBoxIcon. Information );
}

}
Else
{
MessageBox. Show ("sorry, the Information you entered is incorrect", "Logon prompt", MessageBoxButtons. OK, MessageBoxIcon. Information );
}

Although I am not talented, I hope to help you! Maybe you will find a better answer.
 

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.