| |

VerySource

 Forgot password?
 Register
Search
View: 574|Reply: 4

An urgent question about the checkbox in treeview in asp.net ~~

[Copy link]

2

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-25 18:20:01
| Show all posts |Read mode
I added the showcheckbox attribute when I was doing treeview, but because I did n’t know how to add the id of the selected node to the database for the first time, my treeview is database-bound. Please help me, it is better to have detailed code, thank you ~~
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-15 01:45:01
| Show all posts
foreach (TreeNode node in tnBaseNode.Nodes)
{
  if (node.Checked == true)
  {
     // Insert data
  }
}
Reply

Use magic Report

2

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-2-15 09:00:02
| Show all posts
More details, please, I want to write in the OnClick event of Button, I'm in trouble ~~
Reply

Use magic Report

0

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-6-20 11:30:01
| Show all posts
protected void Button1_Click(object sender, EventArgs e)
        {
            ArrayList arr = new ArrayList();
            foreach (TreeNode node in TreeView1.Nodes)
            {
                if (node.Checked == true)
                {
                    arr.Add(node.Value);//node.Value is the bound ID
                }
            }
            . . . . . //Add code to the database
        }
Reply

Use magic Report

2

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-10 19:15:01
| Show all posts
Thanks a lot! !
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