Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am working on treeview.I have a table where im saving treeview checked value.But for update I want the page should show the previously checked treeview checkbox.I have searched a lot and not getting.Please,help me
Thanks,
Posted
Comments
Herman<T>.Instance 12-May-14 3:00am    
what is your question?
[no name] 12-May-14 3:03am    
Hello digimanus,
My question how to get the checked checkbox from database??????
[no name] 12-May-14 3:05am    
Hi,
I have already checked the checkbox.I want the same checked checkbox when im going to edit or update the page..
[no name] 12-May-14 4:12am    
Hi,Im using this code to get the items from database and trying to compare with treeview node whether items already present or not.But its not working,it only goes to false statement.....
Thanks,


StringBuilder sbSQLCompany = new StringBuilder();
sbSQLCompany.Append("Select Features from tblHouseFeatureP");
SqlConnection conn = new SqlConnection();
//conn.ConnectionString = ConfigurationManager.ConnectionStrings["BuckshawHomesConnectionString"].ToString();
try
{
using (SqlConnection cn1 = new SqlConnection(ConfigurationManager.ConnectionStrings["BuckshawHomesConnectionString"].ConnectionString))
{
using (SqlCommand cm1 = new SqlCommand(sbSQLCompany.ToString(), cn1))
{
//cm1.Parameters.AddWithValue("@HouseFeatureID", Membership.GetUser().ProviderUserKey.ToString());
cn1.Open();
using (SqlDataReader rd = cm1.ExecuteReader(CommandBehavior.CloseConnection))
{
while (rd.Read())
{
string s = rd["Features"].ToString();
foreach (TreeNode Node in TreeView1.Nodes[0].ChildNodes)
{
if (Node.Depth == 1)
{
if (Node.Text == rd["Features"].ToString())
{
if (Node.Value == rd["Features"].ToString())
{
Node.Checked = true;
}
else
{

Node.Checked = false;

}

}
}
}
}
}
}
}
}
catch
{

con.Close();

}
}

1 solution

Refer: save and retrieve data from tree checkbox[^]
Scroll to the middle.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900