Stop some events from occuring in treeview control

Discussion in 'ASP .Net Web Controls' started by Martin, Jun 19, 2004.

  1. Martin

    Martin Guest

    Hi,

    I'm usung tree view control in my ASP.Net project.

    I have autopostback enabled because I want to take action immediately if the
    selected index changes. However I have no interest in other events, like
    node expand and collapse, but currently these also cause a postback (to be
    expected).

    I see that all events are queued regardless of whether autopostback is on -
    the notification being delayed until some other button is pressed.

    I do not understand how the nodes do expand and collapse immediately on
    screen when autopostback is false. I am using an uplevel browser, so expect
    DHTML to play a part, but looking at the page source, I don't see it.


    Confused.
    Martin
     
    Martin, Jun 19, 2004
    #1
    1. Advertising

  2. Martin

    Martin Guest

    Okay, I see the DTHML in treeview.htc which is included in the served HTML,
    so I understand how expand and collapse happen on the client side.

    Now I need to know how to control autopostback more finely - not at the
    control level but at the event level.
    ie. I don't want autopostback on the expand and collapse events, but I do
    want it on the selectedindexchanged event.

    Thanks
    Martin

    "Martin" <> wrote in message
    news:...
    > Hi,
    >
    > I'm usung tree view control in my ASP.Net project.
    >
    > I have autopostback enabled because I want to take action immediately if

    the
    > selected index changes. However I have no interest in other events, like
    > node expand and collapse, but currently these also cause a postback (to be
    > expected).
    >
    > I see that all events are queued regardless of whether autopostback is

    on -
    > the notification being delayed until some other button is pressed.
    >
    > I do not understand how the nodes do expand and collapse immediately on
    > screen when autopostback is false. I am using an uplevel browser, so

    expect
    > DHTML to play a part, but looking at the page source, I don't see it.
    >
    >
    > Confused.
    > Martin
    >
    >
     
    Martin, Jun 19, 2004
    #2
    1. Advertising

  3. Martin

    kevinscheidt Guest

    First, I see you posted this to quite a few locations. Good job..
    hehe.. I would have done the same.

    Now, here we go.. This is working for me, but what a @#$)*(#$@()@*
    work around:

    part 1) Add a Valadation Control, and set it to validate the text of
    text box. Set the Textbox to a value of "do not send" and set th
    validator to require the value of the Textbox to be "send"... now jus
    make the textbox invisible. That takes care of the Autopostback, s
    your form will now never submit.. lol...

    part 2) here's the really messed up part: for your code for you
    treenode... do the following:

    nodeLocations.ID = myVarContainingmyCurrentNodeID
    nodeLocations.ID &= """ onclick=""treeClick()"

    notice the Tripple quotes at the start of the 2nd line? That takes yo
    out of the id and into the treenode. Lol then you throw in a onclic
    and finish..

    you end up with this on the client side:
    <tvns:treenode ID="18
    onclick="lblLocation.text=this.value;treeClick()">
    Upstairs
    </tvns:treenode>

    Part 3) finally, add a javascript on your form to allow you to chec
    what you want and post your form only when you want by setting you
    validation field to correct and then submitting. By example, this i
    how you would check that there is no children nodes in your selectio
    and then submit the form based on that...


    function treeClick()
    {
    var src=window.event.srcElement;
    var isFinalNode = src.innerHTML.indexOf('tvns:treenode');
    if (isFinalNode==-1){
    lblLoginFailures.innerText = 'Final Node';
    myvalidationbox.text = "send"
    document.forms[0].submit();
    }else{
    lblLoginFailures.innerText = 'Has Children';
    }



    -
    kevinscheid
    -----------------------------------------------------------------------
    Posted via http://www.mcse.m
    -----------------------------------------------------------------------
    View this thread: http://www.mcse.ms/message778801.htm
     
    kevinscheidt, Jul 11, 2004
    #3
  4. Martin

    KevinScheidt Guest

    How to Stop some events from occuring in treeview control

    First, I see you posted this to quite a few locations. Good job..
    hehe.. I would have done the same

    Now, here we go.. This is working for me, but what a @#$)*(#$@()@*
    work around

    part 1) Add a Valadation Control, and set it t
    validate the text of a text box. Set the Textbox to a value of "d
    not send" and set the validator to require the value of the Textbo
    to be "send"... now just make the textbox invisible. That takes car
    of the Autopostback, so your form will now never submit.. lol..

    [b:8efff0eb5b]part 2)[/b:8efff0eb5b] here's the really messed up
    :twisted: part: for your code for your treenode... do th
    following

    nodeLocations.ID = myVarContainingmyCurrentNodeI
    nodeLocations.ID &= """ onclick=""treeClick()

    notice the Tripple quotes at the start of the 2nd line? That take
    you out of the id and into the treenode. Lol then you throw in
    onclick and finish.

    you end up with this on the client side
    <tvns:treenode ID="18
    onclick="lblLocation.text=this.value;treeClick()"
    Upstair
    </tvns:treenode

    [b:8efff0eb5b]Part 3)[/b:8efff0eb5b] finally, add a javascript on you
    form to allow you to check what you want and post your form only whe
    you want by setting your validation field to correct and the
    submitting. By example, this is how you would check that there is n
    children nodes in your selection and then submit the form based o
    that..

    function treeClick(

    var src=window.event.srcElement
    var isFinalNode = src.innerHTML.indexOf('tvns:treenode')
    if (isFinalNode==-1){
    lblLoginFailures.innerText = 'Final Node'
    myvalidationbox.text = "send
    document.forms[0].submit()
    }else
    lblLoginFailures.innerText = 'Has Children'
     
    KevinScheidt, Jul 12, 2004
    #4
  5. Hi
    Martin i am stucked at the same problem.The solution provided in th
    forum seems to be of little help.
    Can you please help me out.
    Regards
    Ranjeet :


    -
    ranjeet_techi
    -----------------------------------------------------------------------
    Posted via http://www.mcse.m
    -----------------------------------------------------------------------
    View this thread: http://www.mcse.ms/message778801.htm
     
    ranjeet_techie, Jan 3, 2005
    #5
    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. Brian Birtle
    Replies:
    2
    Views:
    2,070
    John Saunders
    Oct 16, 2003
  2. =?Utf-8?B?TmlzaGVldGggS2F1c2hhbA==?=

    Error occuring when i execute Fire method of BaseEvent Class

    =?Utf-8?B?TmlzaGVldGggS2F1c2hhbA==?=, Dec 7, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    411
    =?Utf-8?B?TmlzaGVldGggS2F1c2hhbA==?=
    Dec 7, 2004
  3. Mossman
    Replies:
    1
    Views:
    531
    cbDevelopment
    Dec 12, 2005
  4. TS
    Replies:
    2
    Views:
    4,289
    Steven Cheng[MSFT]
    Jan 23, 2006
  5. Kyle

    Validation Not Occuring

    Kyle, Feb 7, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    474
    George Ter-Saakov
    Feb 7, 2006
Loading...

Share This Page