TreeView checkboxes AutoPostBack with AJAX

Discussion in 'ASP .Net' started by Dmitry Perets, Mar 20, 2007.

  1. Hello,

    There is a known problem with TreeView checkboxes in ASP.NET: they
    can't do AutoPostBack. So I've solved this problem like this:

    <script language="javascript" type="text/javascript">

    function postbackOnCheck()
    {
    var o = window.event.srcElement;
    if (o.tagName == 'INPUT' && o.type == 'checkbox' &&
    o.name != null && o.name.indexOf('CheckBox') > -1)
    {
    __doPostBack("","");
    }
    }

    </script>

    <asp:TreeView onclick="postbackOnCheck()" ID="treeContent"
    runat="server"> ... And so on ... </TreeView> This way I get full
    postback each time the user checks\unchecks the checkbox.

    But now I want to modify this code in order to make use of AJAX: I
    don't want the FULL postback, but I only want the tree itself to be
    updated. Of course, I've started by placing it inside the UpdatePanel.
    But what now? Can somebody help me with this issue?
     
    Dmitry Perets, Mar 20, 2007
    #1
    1. Advertising

  2. Dmitry Perets

    bruce barker Guest

    the treeview is not currently supported inside an updatepanel. you will
    need a different approach.

    -- bruce (sqlwork.com)

    Dmitry Perets wrote:
    > Hello,
    >
    > There is a known problem with TreeView checkboxes in ASP.NET: they
    > can't do AutoPostBack. So I've solved this problem like this:
    >
    > <script language="javascript" type="text/javascript">
    >
    > function postbackOnCheck()
    > {
    > var o = window.event.srcElement;
    > if (o.tagName == 'INPUT' && o.type == 'checkbox' &&
    > o.name != null && o.name.indexOf('CheckBox') > -1)
    > {
    > __doPostBack("","");
    > }
    > }
    >
    > </script>
    >
    > <asp:TreeView onclick="postbackOnCheck()" ID="treeContent"
    > runat="server"> ... And so on ... </TreeView> This way I get full
    > postback each time the user checks\unchecks the checkbox.
    >
    > But now I want to modify this code in order to make use of AJAX: I
    > don't want the FULL postback, but I only want the tree itself to be
    > updated. Of course, I've started by placing it inside the UpdatePanel.
    > But what now? Can somebody help me with this issue?
    >
     
    bruce barker, Mar 20, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex D.

    treeview and autopostback

    Alex D., Oct 28, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    7,562
    Alejandro Penate-Diaz
    Oct 30, 2005
  2. Dmitry Perets
    Replies:
    0
    Views:
    492
    Dmitry Perets
    Mar 20, 2007
  3. ton
    Replies:
    2
    Views:
    2,159
  4. Stefan
    Replies:
    0
    Views:
    166
    Stefan
    Jul 18, 2003
  5. Stu

    Treeview JS error when AutoPostBack=True...

    Stu, Jul 23, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    121
Loading...

Share This Page