Professional Web Applications Themes

capture Multiple events in server controls - ASP.NET Building Controls

Im try to build a control with multiple events rised by different elements but can't find any advanced example that can help me with this. In the case of GridView, it fires many events, one of those is SelectedIndexChaged and other is RowDeleted. when you look at the client script they produce "__doPostBack('GridView1','Select$[index]')" and "__doPostBack('GridView','Delete$[index]')" Is this something i need to create through RaisePostBackEvent to recognize the second argument? or is something already implemented in webcontrol class. All Microsoft examples only show the RaisePostBackEvent(string eventArgument) just with one event like OnClick and the stringArgument is not used, but what if ...

  1. #1

    Default capture Multiple events in server controls

    Im try to build a control with multiple events rised by different elements
    but can't find any advanced example that can help me with this.

    In the case of GridView, it fires many events, one of those is
    SelectedIndexChaged and other is RowDeleted. when you look at the client
    script they produce "__doPostBack('GridView1','Select$[index]')" and
    "__doPostBack('GridView','Delete$[index]')"

    Is this something i need to create through RaisePostBackEvent to recognize
    the second argument? or is something already implemented in webcontrol class.

    All Microsoft examples only show the RaisePostBackEvent(string
    eventArgument) just with one event like OnClick and the stringArgument is not
    used, but what if a i want to work with many events in my control and what if
    they affect just one item of a collection.

    Please refer me to a good source where i can get advanced help on this matter.

    Thanks
    @rturo Guest

  2. #2

    Default Re: capture Multiple events in server controls

    Hi,

    yes you do check this via RaisePostBackEvent and there raise different
    events based on the string argument.

    Here is one article covering the aspects:
    [url]http://www.code-magazine.com/articleprint.aspx?quickid=0511051&printmode=true[/url]


    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    [url]http://blogs.aspadvice.com/joteke[/url]



    "rturo" <rturodiscussions.microsoft.com> wrote in message
    news:F67E8879-A9A2-4EBE-9654-F317884B01BDmicrosoft.com...
    > Im try to build a control with multiple events rised by different elements
    > but can't find any advanced example that can help me with this.
    >
    > In the case of GridView, it fires many events, one of those is
    > SelectedIndexChaged and other is RowDeleted. when you look at the client
    > script they produce "__doPostBack('GridView1','Select$[index]')" and
    > "__doPostBack('GridView','Delete$[index]')"
    >
    > Is this something i need to create through RaisePostBackEvent to recognize
    > the second argument? or is something already implemented in webcontrol
    > class.
    >
    > All Microsoft examples only show the RaisePostBackEvent(string
    > eventArgument) just with one event like OnClick and the stringArgument is
    > not
    > used, but what if a i want to work with many events in my control and what
    > if
    > they affect just one item of a collection.
    >
    > Please refer me to a good source where i can get advanced help on this
    > matter.
    >
    > Thanks

    Teemu Keiski Guest

Similar Threads

  1. Capture events on controls in template columns
    By daniel kurtz in forum ASP.NET Data Grid Control
    Replies: 3
    Last Post: October 11th, 03:11 PM
  2. Custom web control - Unable to capture events with AddHandler in an ITemplate
    By Eli Gassert in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: June 11th, 03:24 AM
  3. Controls events not firing
    By Mike in forum ASP.NET Building Controls
    Replies: 1
    Last Post: February 24th, 02:24 PM
  4. Nesting server controls with a composite control don't generate postback events
    By Stephen Miller in forum ASP.NET Building Controls
    Replies: 8
    Last Post: August 6th, 03:49 AM
  5. Handling Events in Nested Controls
    By DotNetGuru in forum ASP.NET General
    Replies: 1
    Last Post: June 26th, 09:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139