Link to home
Start Free TrialLog in
Avatar of senprog
senprog

asked on

Get the Selected Item Text from the treeview control

I populate the data to a treeview where i need to get the selected text. How to do it..
Below is the code in page_load event.

private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
strSql="Select contentid,headline,menucaption,menulevel,parentmenuorder,";
strSql+="release,contentno from tblcontent";
// Establish Connection
SetConnection();
objContentDa = new OdbcDataAdapter(strSql,ObjCon);
objDs = new DataSet();
objContentDa.Fill(objDs,"Content");
//Clean up.
objDs.Dispose();
objContentDa.Dispose();
ObjCon.Close();
//Populate the TreeView from the DataSet.
foreach (DataRow rowContent in objDs.Tables["Content"].Rows)
{
nodeContent = new TreeNode();
nodeContent.Text = rowContent["menucaption"].ToString();
TreeView1.Nodes.Add(nodeContent);
}
}
When I press a button (server control) i need to get the text on which the user selected the node.

Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Volkan Vardar
Volkan Vardar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial