You must Sign In to post a response.
  • Category: ASP.NET

    Updat ePanel Is not working??

    Hi guys...
    Update panel is not working and whole page is being refreshed although i have used update panel but still my whole page is refreshed?? Please can any one tell me why?? i have also tried to use Triggers but in TreeView case Triggers can't be used.?? Any help will be appreciated
    here is my code
    ==============
    <table width="100%" cellpadding="5" class="table table-striped table-bordered bootstrap-datatable datatable responsive">
    <tr>
    <td class="left" colspan="2">
    <asp:UpdatePanel runat="server" ID="paneltree">
    <ContentTemplate>
    <odc:OdcTreeView ID="OdcTreeView1" Visible="true" runat="server" EnableViewState="true"
    ClientNodeTextChanged="nodeTextChanged" ClientNodeExpanded="expanded" ClientContextMenuOpening="myContextMenu"
    ClientNodeCollapsed="collapsed" ClientNodeSelectionChanged="nodeSelected" Font-Size="9"
    Font-Names="Arial" EnableDragDrop="true" AutoPostBack="false" DisableTextSelection="true"
    EnableClientExpand="true" AllowNodeEditing="true" OnNodeClick="OdcTreeView1_NodeClick"
    oncollapsed="OdcTreeView1_Collapsed" OnNodeExpanded="OdcTreeView1_Expanded" OnNodeCheck="OdcTreeView1_NodeCheck"
    OnNodeCommand="OdcTreeView1_Command" OnEditNode="OdcTreeView1_DblClick" OnNodePopulate="OdcTreeView1_NodePopulate"
    ExpandDepth="7">
    <NodeTemplate>
    <asp:Image runat="server" height="20px" width="20px" ImageUrl="~/Images/imgedit.png" />
    <asp:Label MaxLength="25" isText="true" runat="server" Text="<%# Container.Node.Text %>" />
    <asp:LinkButton ID="btn" runat="server" Text="Update" OnCommand="MyCommand" CommandName="linkupdate"
    CommandArgument="<%# Container.Node.Key %>" UseSubmitBehavior="false" />
    <asp:LinkButton ID="btnAdd" runat="server" Text="Add" OnCommand="MyCommandAdd" CommandName="linkAdd"
    CommandArgument="<%# Container.Node.Key %>" UseSubmitBehavior="false" />
    <asp:LinkButton ID="btnDelete" runat="server" Text="Delete" OnCommand="MyCommand"
    CommandName="linkDel" CommandArgument="<%# Container.Node.Key %>" UseSubmitBehavior="false" />
    </NodeTemplate>
    <ContextMenuTemplate>
    <div style="padding: px; margin: 5px;">
    <asp:LinkButton ID="LinkButton1" runat="server" Text="Rename" CommandName="rename" /><br />
    <asp:LinkButton ID="LinkButton2" runat="server" Text="Insert" CommandName="insert" /><br />
    <asp:LinkButton ID="LinkButton3" runat="server" Text="Delete" CommandName="delete" />
    </div>
    </ContextMenuTemplate>
    <Nodes>
    <odc:OdcTreeNode Text="Add Hierarchy items">
    </odc:OdcTreeNode>
    </Nodes>
    </odc:OdcTreeView>
    <a id="custom">-</a>
    <script type="text/javascript">
    function expanded(node, e) {
    if (node.getText() >= "4") alert("Expanded: " + node.getText());
    }

    function collapsed(node, e) {
    if (node.getText() >= "4") alert("Collapsed: " + node.getText());
    }

    function nodeTextChanged(node, e) {
    var txt = node.getText();
    var e = document.getElementsByName("custom");
    e[0].innerHTML = "changed: " + txt;

    }

    function nodeSelected(node, e) {
    var value = node.get_selected();
    if (value) {
    //node.setText("OK");
    var txt = node.getText();
    var e = document.getElementsByName("custom");
    e[0].innerHTML = "selected: " + txt;
    }

    }
    function myContextMenu(tree, e) {
    var cm = e.menuElement;
    var node = e.node;
    var text = node.getText();
    if (node.isFirst()) {
    e.set_cancel(true);
    alert("no menu for the first item!");
    }
    if (text == "3.3.1") cm.style.backgroundColor = "Red"; else cm.style.backgroundColor = "";
    }

    </script>
    </ContentTemplate>
    </asp:UpdatePanel>
    </td>
    </tr>
    </table>
  • #765708
    Hi,

    It's too difficult to read and understand your full design, my suggestion is just try to implement one small application using updatepanel and triggers and pass the event name in triggers then check, whether page gets refreshed or not, it won't be refreshed I guess the problem might be different, check with your browser.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


Sign In to post your comments