Request.Form("__EVENTTARGET") = "" ???

Discussion in 'ASP .Net Web Controls' started by Dan, Dec 8, 2003.

  1. Dan

    Dan Guest

    I am trying to use
    Request.Form("__EVENTTARGET") to get the name of the control that caused a post back. It keeps returning "".

    I am not really sure why, this happens for all of my controls that invoke are invoking a post back.

    I've never used this type of method before, but I need to get the name of the control doing the postback in the Form Load event, and cannot wait until the event of the target control that runs due to the postback.
     
    Dan, Dec 8, 2003
    #1
    1. Advertising

  2. Dan

    Mythran Guest

    Try Request.Form("__EVENTARGUMENT")

    :)

    Mythran


    "Dan" <> wrote in message
    news:...
    I am trying to use
    Request.Form("__EVENTTARGET") to get the name of the control that caused a
    post back. It keeps returning "".

    I am not really sure why, this happens for all of my controls that invoke are
    invoking a post back.

    I've never used this type of method before, but I need to get the name of the
    control doing the postback in the Form Load event, and cannot wait until the
    event of the target control that runs due to the postback.
     
    Mythran, Dec 8, 2003
    #2
    1. Advertising

  3. Dan

    Dan Guest

    same..

    just a blank string
    "Mythran" <> wrote in message news:...
    Try Request.Form("__EVENTARGUMENT")

    :)

    Mythran


    "Dan" <> wrote in message news:...
    I am trying to use
    Request.Form("__EVENTTARGET") to get the name of the control that caused a post back. It keeps returning "".

    I am not really sure why, this happens for all of my controls that invoke are invoking a post back.

    I've never used this type of method before, but I need to get the name of the control doing the postback in the Form Load event, and cannot wait until the event of the target control that runs due to the postback.
     
    Dan, Dec 8, 2003
    #3
  4. Dan

    Aurel Guest

    I have already ask for it, because I have the same pb since i change my framework1.0 to 1.1 !

    The answer:
    It is not a good way to use Request.Form["__EventTarget"] and eventArgument because Microsoft don't guaranteed that event reference will be always call like this.

    Aurel


    "Dan" <> a écrit dans le message de news: #...
    same..

    just a blank string
    "Mythran" <> wrote in message news:...
    Try Request.Form("__EVENTARGUMENT")

    :)

    Mythran


    "Dan" <> wrote in message news:...
    I am trying to use
    Request.Form("__EVENTTARGET") to get the name of the control that caused a post back. It keeps returning "".

    I am not really sure why, this happens for all of my controls that invoke are invoking a post back.

    I've never used this type of method before, but I need to get the name of the control doing the postback in the Form Load event, and cannot wait until the event of the target control that runs due to the postback.
     
    Aurel, Dec 8, 2003
    #4
  5. Dan

    Dan Guest

    hmm, so I wonder how I can find out what control caused the postback in the pageload..?
    "Aurel" <> wrote in message news:...
    I have already ask for it, because I have the same pb since i change my framework1.0 to 1.1 !

    The answer:
    It is not a good way to use Request.Form["__EventTarget"] and eventArgument because Microsoft don't guaranteed that event reference will be always call like this.

    Aurel


    "Dan" <> a écrit dans le message de news: #...
    same..

    just a blank string
    "Mythran" <> wrote in message news:...
    Try Request.Form("__EVENTARGUMENT")

    :)

    Mythran


    "Dan" <> wrote in message news:...
    I am trying to use
    Request.Form("__EVENTTARGET") to get the name of the control that caused a post back. It keeps returning "".

    I am not really sure why, this happens for all of my controls that invoke are invoking a post back.

    I've never used this type of method before, but I need to get the name of the control doing the postback in the Form Load event, and cannot wait until the event of the target control that runs due to the postback.
     
    Dan, Dec 8, 2003
    #5
  6. Not all controls postback the same way. You got various controls that postback and support different methods. Its been a long time and i dont rem what works with what off the top of my head. You might want to experiement with different methods. Here are the various methods you need to try and use. One of them is got to work for you ;)

    If Request.Params.Item("btnSubmit") <> Nothing Then
    --Do something---
    Else
    --Do something else---
    End If

    If Request.Params("btnSubmit") <> Nothing Then
    --Do something---
    Else
    --Do something else---
    End If

    If Request.Form("btnSubmit") <> Nothing Then
    --Do something---
    Else
    --Do something else---
    End If

    string postBackControl = Request.Params.Get("__EVENTTARGET");
    "Dan" <> wrote in message news:...
    hmm, so I wonder how I can find out what control caused the postback in the pageload..?
    "Aurel" <> wrote in message news:...
    I have already ask for it, because I have the same pb since i change my framework1.0 to 1.1 !

    The answer:
    It is not a good way to use Request.Form["__EventTarget"] and eventArgument because Microsoft don't guaranteed that event reference will be always call like this.

    Aurel


    "Dan" <> a écrit dans le message de news: #...
    same..

    just a blank string
    "Mythran" <> wrote in message news:...
    Try Request.Form("__EVENTARGUMENT")

    :)

    Mythran


    "Dan" <> wrote in message news:...
    I am trying to use
    Request.Form("__EVENTTARGET") to get the name of the control that caused a post back. It keeps returning "".

    I am not really sure why, this happens for all of my controls that invoke are invoking a post back.

    I've never used this type of method before, but I need to get the name of the control doing the postback in the Form Load event, and cannot wait until the event of the target control that runs due to the postback.
     
    Alessandro Zifiglio, Dec 8, 2003
    #6
  7. Dan

    Mythran Guest

    And one other way...

    If Request("btnSubmit") Is Nothing Then
    ' The btnSubmit button was NOT clicked.
    Else
    ' The btnSubmit button was clicked.
    End If

    If using VB :)

    Mythran

    "Alessandro Zifiglio" <> wrote in message
    news:Lk4Bb.14016$...
    Not all controls postback the same way. You got various controls that postback
    and support different methods. Its been a long time and i dont rem what works
    with what off the top of my head. You might want to experiement with different
    methods. Here are the various methods you need to try and use. One of them is got
    to work for you ;)

    If Request.Params.Item("btnSubmit") <> Nothing Then
    --Do something---
    Else
    --Do something else---
    End If

    If Request.Params("btnSubmit") <> Nothing Then
    --Do something---
    Else
    --Do something else---
    End If

    If Request.Form("btnSubmit") <> Nothing Then
    --Do something---
    Else
    --Do something else---
    End If

    string postBackControl = Request.Params.Get("__EVENTTARGET");
    "Dan" <> wrote in message
    news:...
    hmm, so I wonder how I can find out what control caused the postback in the
    pageload..?
    "Aurel" <> wrote in message
    news:...
    I have already ask for it, because I have the same pb since i change my
    framework1.0 to 1.1 !

    The answer:
    It is not a good way to use Request.Form["__EventTarget"] and eventArgument
    because Microsoft don't guaranteed that event reference will be always call like
    this.

    Aurel


    "Dan" <> a écrit dans le message de news:
    #...
    same..

    just a blank string
    "Mythran" <> wrote in message
    news:...
    Try Request.Form("__EVENTARGUMENT")

    :)

    Mythran


    "Dan" <> wrote in message
    news:...
    I am trying to use
    Request.Form("__EVENTTARGET") to get the name of the control that
    caused a post back. It keeps returning "".

    I am not really sure why, this happens for all of my controls that
    invoke are invoking a post back.

    I've never used this type of method before, but I need to get the
    name of the control doing the postback in the Form Load event, and cannot wait
    until the event of the target control that runs due to the postback.
     
    Mythran, Dec 8, 2003
    #7
  8. Dan

    bruce barker Guest

    this only set for controls that you set autopostback on, it is blank for <asp:button> or <asp:imagebutton>, as they use the standard form post rules.

    -- bruce (sqlwork.com)



    "Dan" <> wrote in message news:...
    I am trying to use
    Request.Form("__EVENTTARGET") to get the name of the control that caused a post back. It keeps returning "".

    I am not really sure why, this happens for all of my controls that invoke are invoking a post back.

    I've never used this type of method before, but I need to get the name of the control doing the postback in the Form Load event, and cannot wait until the event of the target control that runs due to the postback.
     
    bruce barker, Dec 8, 2003
    #8
  9. Dan

    Dan Guest

    ok, so how is it possible to acheieve similar results with an ASP:Button ?

    Any ideas?
    "bruce barker" <> wrote in message news:#...
    this only set for controls that you set autopostback on, it is blank for <asp:button> or <asp:imagebutton>, as they use the standard form post rules.

    -- bruce (sqlwork.com)



    "Dan" <> wrote in message news:...
    I am trying to use
    Request.Form("__EVENTTARGET") to get the name of the control that caused a post back. It keeps returning "".

    I am not really sure why, this happens for all of my controls that invoke are invoking a post back.

    I've never used this type of method before, but I need to get the name of the control doing the postback in the Form Load event, and cannot wait until the event of the target control that runs due to the postback.
     
    Dan, Dec 9, 2003
    #9
  10. Dan

    vMike Guest

    If your _EVENTTARGET is "" then you would need iterate through your Form Keys maybe Request.Form.AllKeys(i) will work. I have never tried it. One of the keys has the control name and x and another has the controlname and y position I think.


    "Dan" <> wrote in message news:...
    I am trying to use
    Request.Form("__EVENTTARGET") to get the name of the control that caused a post back. It keeps returning "".

    I am not really sure why, this happens for all of my controls that invoke are invoking a post back.

    I've never used this type of method before, but I need to get the name of the control doing the postback in the Form Load event, and cannot wait until the event of the target control that runs due to the postback.
     
    vMike, Dec 9, 2003
    #10
    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. Dan
    Replies:
    9
    Views:
    8,943
    vMike
    Dec 9, 2003
  2. Nuno
    Replies:
    2
    Views:
    8,488
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Feb 10, 2005
  3. RJN
    Replies:
    1
    Views:
    8,442
    bruce barker
    Mar 15, 2005
  4. where is __EVENTTARGET ?

    , Apr 21, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    8,510
    Lau Lei Cheong
    Apr 21, 2005
  5. Kenneth Baltrinic
    Replies:
    1
    Views:
    512
    bruce barker
    May 31, 2007
Loading...

Share This Page