I am trying to make the nodes clickable so that I can do something when they are clicked. I am doing simple manual binding using a list of objects. I am only binding one level at a time because of how deep our heirarchy can be. So when they click on the node I will bind the level below that person. I have a button inside an item template. After the nodes render, I click on the button and it does a post back but does not fire the button click event. If I click it a second time it does a postback and DOES fire the button click event. I have also tried to handle the GroupItemDataBound to use the FindControl you introduced in SP1 with the hopes of attaching the event there instead of the markup as I am doing below. How ever FindControl("LinkButtonNode") returned null. Please advise as I have not run into this before. Or if you know a better way to make the node clickable please advise.
Markup:
Code behind:
DataAccess:
Markup:
<telerik:RadOrgChart ID="RadOrgChartDirectReports1" EnableViewState="true" Skin="Office2010Silver" runat="server"> <ItemTemplate> <asp:Button CausesValidation = "false" OnClick="LinkButton_Click" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "EmployeeId")%>' runat="server" Text = "Click" ID="LinkButtonNode"></asp:Button> </ItemTemplate> </telerik:RadOrgChart>Code behind:
private void BindOrgChart2() { RadOrgChartDirectReports1.DataSource = DataAccess.GetNewHireList(); RadOrgChartDirectReports1.DataBind(); }public void LinkButton_Click(object sender, EventArgs e) { string test = ""; }DataAccess:
namespace RadControlsTestWebApp1{ public class DataAccess { public static List<HeirarchyBind> GetNewHireList() { var list = new List<NewHireNotification>(); using (var client = new RadControlsTestWebApp1.EmployeeService.NewHireNotificationClient()) { list = client.GetEmployeeNewHireNotifications(null); } var newlist = list.Select(x => new HeirarchyBind { Name = string.Format("{0} '{1}' {2}", x.HireInformation.FirstName, x.HireInformation.PreferredName, x.HireInformation.LastName), EmployeeId = x.HireInformation.EmployeeId, }).ToList(); return newlist; } }}