|
Hello
I've populated a tree view from a selfjoined table and now I want to handle the event such that when the user clicks a node, I should just show the data of that record in a formview. I've done something similar in a desktop application but got no idea how to do it here. OnNodeClick was the event in desktop's case but here I dont know how to handle this situation
plz give me a few guidelines
Thanks
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
u check once the selection node changed property of the treeview
|
|
|
|
|
u mean I should handle SelectedNodeChanged event right
void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
//TreeNode
}
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
|
I'm on it and hoping for the best
Thanks
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Unable to cast object of type 'System.Web.UI.WebControls.TreeView' to type 'System.Web.UI.WebControls.TreeNode'
Thats the error I'm getting, here's my code
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
TreeNode node = (TreeNode)sender;
int id = Convert.ToInt32(node.Value);
Categories objCat = new Categories();
objCat.Where.ID.Value = id;
if (objCat.Query.Load())
{
TextBox tb = FormView1.FindControl("CatNameTextBox") as TextBox;
tb.Text = objCat.CatName;
tb = FormView1.FindControl("DescriptionTextBox") as TextBox;
tb.Text = objCat.Description;
CheckBox ck = FormView1.FindControl("IsActiveChkBox") as CheckBox;
ck.Checked = objCat.IsActive;
}
}
what I wanna do is to take the TreeNode Object coz its text and value are the CategoryName and ID respectively. But its unable to cast it to treeNode. Now what??!!
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Rocky# wrote: TreeNode node = (TreeNode)sender;
Sender is a TreeView.
So convert it to TreeView and from that find the node using FindNode method.
|
|
|
|
|
but how will I know which node was clicked?
how will I find the node that was clicked? Its EventArgs is having no info regarding that?
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
The TreeViewControl.SelectedNode gives the selected node. You can use it in the SelectedNodeChanged Event of the TreeView.
|
|
|
|
|
oh sorry, I didnt see it
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
hi,
What about this
MyTreeView.SelectedNode
|
|
|
|
|
yea I got it just a few moments ago.
Thanks v much , gave for 5 for that Cheers..
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
the file upload property name file upload is returning false when a zero bytes file is uploaded .but i want even the zero bytes file also should be loaded how could be possible
|
|
|
|
|
Instead of uploading such files, can you directly create it on the destination machine?
Nana
|
|
|
|
|
I mean only 0 bytes files, create it
Nana
|
|
|
|
|
actually the file upload is returing 0bytes file as false ..iam having one function in if condiotn of the zero bytes file that is reason the file upload is not working for 0 bytes so any ohter method is there to upload a file
|
|
|
|
|
I believe, you haven't see the UploadControl.PostedFile.ContentLength property which would return the File Size.
|
|
|
|
|
I have treeview control in my website and each node also has a image. When user click on a node the page redirect to another page. Now my question is , is it possible to have two different url, one for clicking on image node and another for clicking on node text?
Mazy
"This chancy chancy chancy world."
|
|
|
|
|
Use JavaScript and overrides the Links. But it is a complicated one and bring up performance issues if the data is huge, since JavaScript executes on Client Side (After the Server-Side Load).
|
|
|
|
|
|
What do you mean by run time? If you want to check the checked property of a control inside gridview then first you need to search that control and then you can check whether it is checked or not.
Apurva Kaushal
|
|
|
|
|
Hi,
check this.
bool chkValue = ((CheckBox)selectedRow.Cells[0].Controls[0]).Checked
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
Thanks for your kind reply.
Its not a checkbox template .we add a checkboxfield as row.how we get the boolean status of checkboxfield in a grid dynamically......
|
|
|
|
|
Hi, the same thing I have given you. Its for Checkbox field dear.
try..
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
Why did you delete your original query?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|