| |

VerySource

 Forgot password?
 Register
Search
View: 1352|Reply: 15

| M | Interview Today: I thought it was a simple question, but I couldn't do it. Very depressed, everyone analyzes

[Copy link]

2

Threads

11

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-2-16 11:30:02
| Show all posts |Read mode
After binding the order table (Figure 1)
 ------------------------------------------
| id | name | business results | |
 ------------------------------------------
| 1 | Xiao Zhang | 100000 | Details |
 ------------------------------------------
| 2 | Xiao Wang | 20000 | Details |
 ------------------------------------------
| 3 | Xiao Li | 80000 | Details |
 ------------------------------------------
The requirement is to click the detail to display the business details (orderview) of the current employee, such as clicking Xiao Wang (Figure 2)
 ------------------------------------------
| id | name | business results |
 ------------------------------------------
| 1 | Xiao Zhang | 100000 | Details |
 ------------------------------------------
| 2 | Xiao Wang | 20000 | Details |
 ------------------------------------------
| Software Engineering | 06-01-12 | 8000 |
 ------------------------------------------
| Website Development | 06-11-10 | 12000 |
 ------------------------------------------
| 3 | Xiao Li | 80000 | Details |
 ------------------------------------------
-------------------------------------------------- -----------
Here's my approach:
I thought it would be OK to use a DataList to nest a GridView
But here comes the problem. Because each row in the DataList is a table, the table displayed after binding becomes messy, such as:
The code that originally required binding was
<table>
<tr>
  <td> 1 </ td> Xiao Zhang <td> 100000 </ td> <td> Details </ td>
</ tr>
....
</ table>
But after binding with DataList is
<table>
 <tr>
  <td>
    <table>
     <tr>
      <td> 1 </ td> Xiao Zhang <td> 100000 </ td> <td> Details </ td>
     </ tr>
   </ table>
  </ td>
 </ tr>
 ....
</ table>
This format causes data to be misaligned
There is no problem with the function of Figure 1 if it is bound with GridView
But I do n’t know how to implement the function of Figure 2.

How to solve this problem
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-4-18 12:30:01
| Show all posts
Using repeater is more flexible.
Reply

Use magic Report

0

Threads

38

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-4-18 16:00:01
| Show all posts
It is better to output the table tr td string by yourself
Reply

Use magic Report

2

Threads

11

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-4-18 17:15:02
| Show all posts
RE: net_lover (【Mencius Chapter E】)
-----------------
<div style = "width: 100%; padding: 2px; font-weight: bold; background-color: #DEDEDE;
              float: left ">
              <span style = "float: left"> Column name: <% # Eval ("Title")%> </ span> <span style = "float: right;
                color: Red; cursor: pointer "onclick =" ShowHidden ('<% # Eval ("id")%>', event) "> Hide </ span> </ div>
            <div style = "background-color: #FFF; padding-left: 60px; clear: both" id = "div <% # Eval (" id ")%>">
---------------------
This is the display of what you said in the year | id | Name | Total business performance | |
Obviously yours is done with Div. For example, because you only have two columns, one left and one right, there will be no confusion if there are more
And mine is showing a field with a lot of records if you write like this
If there are many records, there will be confusion and not as neat as the binding with GridView
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-4-22 01:45:01
| Show all posts
Wait a minute, I write.
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-22 10:45:01
| Show all posts
RE:cqgang(
I also thought about writing Table by myself, but it would be very troublesome to write if there are events in the line
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-4-22 16:00:01
| Show all posts
if (e.Row.RowType == DataControlRowType.DataRow)
        {
            GridViewRow row = new GridViewRow (e.Row.RowIndex + 1, e.Row.RowIndex, DataControlRowType.DataRow, DataControlRowState.Normal);
            this.GridView1.Controls [0] .Controls.Add (row);
            row.Cells.Add (new TableCell ());
            row.Cells [0] .ColumnSpan = e.Row.Cells.Count;
            row.Cells [0] .Text = "<TABLE WIDTH = '100%'> <TR> <TD> AA </ TD> <TD> BB </ TD> <TD> CC </ TD> </ TR> </ TABLE> ";
            Response.Write (row.Cells.Count.ToString () + "**");
        }
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-4-22 16:45:02
| Show all posts
This is just a simple one, where HTML is written directly, and no data is bound with controls.
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-4-22 17:30:01
| Show all posts
There is no click event.
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-4-22 17:45:01
| Show all posts
Wait for me to improve.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list