Home > Net >  Asp: treeview dynamically generated table
Asp: treeview dynamically generated table

Time:11-04

Existing treeview, and set up ShowCheckBoxes="Leaf"
A
1
- A.2
- A.B
C

So is a. 1, a. 2, B, C this four nodes have the checkbox
Check the B, write asp: table line B,
1, then check the a. by foreach (TreeNode t in the treeview. CheckedNodes) method into asp page: table row a. 1
But, in the background again through the foreach (TreeNode t in the treeview. CheckedNodes) again write asp: table rows, change order is
The (original) :
1 B
1
2 A.Once again become
1
1 A.2 B
Asp: the table itself is dynamic in the other controls in the background, this leads to submit asp: the table data acquisition is not accurate,
There is a clear that provide the solution?
Thank you

CodePudding user response:

What do you mean by this once again? Is what actions lead to rewrite the table, had better use js, in fact these things on the front end,

CodePudding user response:

reference 1st floor EdsionWang response:
what do you mean by this once again? Is what actions lead to rewrite the table, had better use js, in fact these things on the front end,


Not good at writing js, so is on in the background, in order to guarantee the asp: table to fill in the data can be retained on the page, so
Foreach (TreeNode t in the treeview. CheckedNodes)
Is in
if (! Front Page. IsPostBack), then click on the submit postback inevitably cause again, at this time of CheckedNodes becomes obtained in the treeview node order,
So cause and asp: table page written order there is a difference, (page still shows the original order, the actual submit it has turned into a sequential)

CodePudding user response:

Abandoning the webform.
Front-end js fix this problem, very simple
  • Related