This is a migrated thread and some comments may be shown as answers.

OrgChartNodeDropEventArguments make LinkButton onClick false on first click

1 Answer 81 Views
OrgChart
This is a migrated thread and some comments may be shown as answers.
Peerayu
Top achievements
Rank 1
Peerayu asked on 25 Jun 2014, 06:34 AM
Hi, I'm using Telerik 2014.1.403.45. I have the problem with the LinkButton in my RadOrgChart node.

I put RadOrgChart in RadAjaxPanel. there are the LinkButtons in OrgChart Nodes. LinkButtons work correctly after page_load.
However, if I dragged and dropped the node and then clicked on a LinkButton, it will only do postback to page_load but no CommandEventArgs . The events of the LinkButton only works on the second click.

Page
<telerik:RadAjaxPanel ID="panOrganize" runat="server" CssClass="OrganizeCanvas" LoadingPanelID="radAjaxLoadingPanel">
    <telerik:RadTabStrip ID="rtabOrganize" runat="server" MultiPageID="rmpOrganize" SelectedIndex="0" Width="100%" CssClass="FontBold" OnTabClick="rtabOrganize_TabClick">
        <Tabs>
            <telerik:RadTab CssClass="FontBold" Text="Organize Chart" />
            <telerik:RadTab CssClass="FontBold" Text="Position" Enabled="false" />
            <telerik:RadTab CssClass="FontBold" Text="User" Enabled="false" />
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="rmpOrganize" runat="server" SelectedIndex="0">
  
        <telerik:RadPageView ID="rpvOrgOrganize" runat="server" Width="100%">
            <telerik:RadOrgChart ID="radOrgChart" runat="server" Width="100%" CssClass="SpacingBottom20" LoadOnDemand="Nodes"
                DataFieldID="OrgID" DataFieldParentID="ParentID"
                EnableDragAndDrop="true" OnNodeDrop="radOrgChart_NodeDrop">
                <ItemTemplate>
                    <asp:Panel ID="panNode" runat="server" CssClass="TemplateHolder">
                        <asp:Table ID="tbOrgChart" runat="server" Width="160px" Height="50px">
                            <asp:TableRow>
                                <asp:TableCell RowSpan="3" Width="30px" VerticalAlign="Middle">
                                        <i class="fa fa-home FontSize28"></i>
                                </asp:TableCell>
                                <asp:TableCell Width="5px" />
                                <asp:TableCell VerticalAlign="Top">
                                    <asp:Label ID="lblTypeName" runat="server" Text='<%# Eval("OrganizationType.TypeName")%>' CssClass="FontBold" />
                                </asp:TableCell>
                                <asp:TableCell Width="10px">
                                    <asp:LinkButton ID="lbtnSearch" runat="server" BorderStyle="None"
                                        CommandArgument='<%# Eval("OrgID")%>' CommandName='<%# Eval("Name")%>' OnCommand="lbtnSearch_Command">
                                        <i class="fa fa-search-plus"></i>
                                    </asp:LinkButton>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell RowSpan="2" />
                                <asp:TableCell RowSpan="2" ColumnSpan="2" VerticalAlign="Top">
                                    <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name")%>' />
                                </asp:TableCell>
                            </asp:TableRow>
                        </asp:Table>
                    </asp:Panel>
                </ItemTemplate>
            </telerik:RadOrgChart>
            <telerik:RadContextMenu runat="server" ID="radContextMenu" CssClass="CustomContextMenu" Skin="Default" OnClientItemClicked="onClientItemClicked">
                <Items>
                    <telerik:RadMenuItem Text="Add" CssClass="rmAdd" Value="Add" />
                    <telerik:RadMenuItem Text="Edit" CssClass="rmEdit" Value="Edit" />
                    <telerik:RadMenuItem Text="Remove" CssClass="rmRemove" Value="Remove" />
                </Items>
            </telerik:RadContextMenu>
            <telerik:RadWindow ID="radWindow" runat="server" AutoSize="true" Modal="true" Behaviors="Close"
                VisibleTitlebar="true" VisibleStatusbar="false" OnClientClose="onClientClose">
            </telerik:RadWindow>
        </telerik:RadPageView>
  
        <telerik:RadPageView ID="rpvOrgPosition" runat="server" Width="100%">
        </telerik:RadPageView>
  
        <telerik:RadPageView ID="rpvOrgUser" runat="server" Width="100%">
        </telerik:RadPageView>
  
    </telerik:RadMultiPage>
</telerik:RadAjaxPanel>

Code Behind (C#)
protected void Page_Load(object sender, EventArgs e)
{
    radOrgChart_Load();
}
 
protected void radOrgChart_Load()
{
    radOrgChart.DataSource = String.Empty;
 
    //Get Data from EF
    List<Organization> listOrganize = organizeManager.GetOrganize();
    if (listOrganize.Count.Equals(0).Equals(false))
    {
        radOrgChart.DataSource = listOrganize;
    }
    radOrgChart.DataBind();
}
 
protected void radOrgChart_NodeDrop(object sender, OrgChartNodeDropEventArguments e)
{
    //Update Database
    organizeManager.UpdateParentID(new Guid(e.SourceNode.ID), new Guid(e.DestinationNode.ID));
 
    //Load the new data
    radOrgChart_Load();
}
 
 
 
protected void lbtnSearch_Command(object sender, CommandEventArgs e)
{
    //Open The second Tab, and set enable
    rtabOrganize_SetEnable(true, 1);
    rtabOrganize_SelectIndex(1);
 
    //Set data into ViewState
    vsOrganizationID = e.CommandArgument.ToString();
    vsOrganizationName = e.CommandName;
}

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 30 Jun 2014, 03:20 PM
Hello Peerayu,

I would suggest you to refer to the following forum thread, where the issue is explained and a possible solution is provided by Peter Filipov:

http://www.telerik.com/forums/button-click-in-item-template-not-always-firing-with-example


Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
OrgChart
Asked by
Peerayu
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or