|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Custom Treenodes in TreeviewIam a using a custom treeview control, taking an example from http://fredrik.nsquared2.com/viewpost.aspx?PostID=299. I have created two hyperlink's after each node in the treeview. When i click on any one of the hyperlink's the selectednodechanged event of the custom treeview control is not firing up. My sample treenode is as below. <<Some Text>> hyperlink1 hyperlink2 I am creating hyperlink1 and hyperlink2 as follows protected override void RenderPostText(HtmlTextWriter writer) { writer.Write(" "); writer.WriteBeginTag("A"); writer.WriteAttribute("href", "Treeview.aspx" ); writer.Write(">"); writer.Write("Reply"); writer.WriteEndTag("A"); writer.Write(" "); writer.Write(" "); writer.Write(" "); writer.WriteBeginTag("A"); writer.WriteAttribute("href", "Treeview.aspx"); writer.Write(">"); writer.Write("Edit"); writer.WriteEndTag("A"); } Any furthur comments and suggestions are welcome. Thanks in advance. For ease of coding, I'd recommend this instead:
HyperLink link = new HyperLink(); link.NavigateUrl = "TreeView.aspx"; link.Text = "Edit"; link.RenderControl(writer); Are your treenodes showing URLs or are they javascript method calls? If they are the former, then your tree is in navigate mode, and thus the selection events won't fire. You can change the mode by altering the binding for that particular node depth (via the DataBindings child element for the TreeView) Thanks Patrick,
Can you tell me in more detail how to change the navigate mode. Also how do i remove the hyperlinks for the Nodes (Not the two hyperlinks i have added)and make them as simple text. Is it possible to do so? Thanks, SunSMile Show quoteHide quote "Keith Patrick" wrote: > For ease of coding, I'd recommend this instead: > HyperLink link = new HyperLink(); > link.NavigateUrl = "TreeView.aspx"; > link.Text = "Edit"; > link.RenderControl(writer); > > Are your treenodes showing URLs or are they javascript method calls? If > they are the former, then your tree is in navigate mode, and thus the > selection events won't fire. You can change the mode by altering the > binding for that particular node depth (via the DataBindings child element > for the TreeView) > > > Yeah, basically it's a matter of the databinding. This is an example of a
databinding that sets the 3rd nest level of a tree I have bound to a SiteMapDataSource (hence the field names of "url" and "title") to selection mode (as you can see by the URL, which is a call do doPostback): <DataBindings> <asp:TreeNodeBinding Depth="2" NavigateUrlField="" DataMember="" TextField="Title" ValueField="url" /> </DataBindings> The key to taking out the URLs lies with setting the data and navigateURL members to String.Empty. The ValueField determines what the CommandArgument is going to be (and is passed in as a param to doPostback) Thanks patrick,
That did the trick. Show quoteHide quote "Keith Patrick" wrote: > Yeah, basically it's a matter of the databinding. This is an example of a > databinding that sets the 3rd nest level of a tree I have bound to a > SiteMapDataSource (hence the field names of "url" and "title") to selection > mode (as you can see by the URL, which is a call do doPostback): > <DataBindings> > <asp:TreeNodeBinding Depth="2" > NavigateUrlField="" > DataMember="" > TextField="Title" > ValueField="url" /> > </DataBindings> > > The key to taking out the URLs lies with setting the data and navigateURL > members to String.Empty. The ValueField determines what the CommandArgument > is going to be (and is passed in as a param to doPostback) > > >
programmatically copy table to another application
What functionality does Infragistics controls offer, which don't come with VS .NET 2005? grid postback Referencing controls inside Wizard control newbie to creating web controls Code to select item in dropdown populated using TableAdapter Closing window/page Datagrid Problem in Setting SelectedValue for DropdownList in Form Adding a Directive to a dynamically created Template Column on gri |
|||||||||||||||||||||||