Solved

Disable the textbox when a certain treeview node is selected

Posted on 2011-03-19
2
419 Views
Last Modified: 2013-12-17
hi,

I have a treeview on the left and a textbox on the right devided by a splitter.
What treeview-event should i use when I want to disable the textbox
when a user clicks on a treeview node that has a imageindex 3.

I would say: the afterselect-event but I have allready code there to show text
in the textbox when a treeview node is selected.

        private void tvNotes_AfterSelect(object sender, TreeViewEventArgs e)
        {
            DataRow row = e.Node.Tag as DataRow;
            txtbNotes.Text = row["Data"].ToString();
        }


Who can help me?

Greetings, peterkiers
0
Comment
Question by:peterkiers
2 Comments
 
LVL 7

Accepted Solution

by:
nbove earned 500 total points
ID: 35171867
Modify your event handler to the following:

private void tvNotes_AfterSelect(object sender, TreeViewEventArgs e)
{
  DataRow row = e.Node.Tag as DataRow;
  txtbNotes.Text = row["Data"].ToString();
  if (e.Node.ImageIndex == 3)
  {
    txtbNotes.Enabled = false;
  }
  else
  {
    txtbNotes.Enabled = true;
  }
}
0
 
LVL 1

Author Comment

by:peterkiers
ID: 35171877
Thanx it works.

Peter
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now