Thanks for your help again Phillip. I tend to be very inquisitive by
nature... my apologies in advance.. :)
1) What do you mean by "create a more elaborate custom event?" :)
2) To bubble events in user created controls, you have to inherit from
control and override RaiseBubbleEvent . Why is this? Why cant you get away
with what you did in your example?
If you could point me to articles, that would also be helpful rather than
typing out huge replies. :)
Thanks a mill again,
Girish
"Phillip Williams" <Phillip.Williams@webswapp.com> wrote in message
news:CE744586-444C-431F-8CE6-FEA9C2FB6BB5@microsoft.com...[color=blue]
> This is a quick modification of your code to make the Event Bubbling works
>
http://www.societopia.net/samples/webform6.aspx
>
> If I had more time I could have probably created a more elaborate custom
> event.
>
> I would still prefer the EditItem Template strategy as I mentioned in the
> previous email. It is much cleaner.
>
> Phillip
> --
>
http://www.webswapp.com
>
>
> "Girish" wrote:
>[color=green]
>> Appreciate the insight into page load size. I dont think this will be an
>> issue since we will be working with barely 10 rows per page.
>>
>> I looked at Event Bubbling, but it requires that my DropDownListColumn
>> inherit from class Control. My DropDownListColumn already inherits from
>> DataGridColumn so i cant multiple inherit... im sure im missing something
>> simple here. pse advice.
>>
>> thanks,
>> Girish
>>
>>
>> "Phillip Williams" <Phillip.Williams@webswapp.com> wrote in message
>> news:56389550-1E68-4541-B9DF-FC928AFC0AEB@microsoft.com...[color=darkred]
>> > "Girish" wrote:
>> >
>> >> My Question:
>> >>
>> >> 1) How do I setup ONE postback event handler for ALL the drop downlist
>> >> controls being rendered dynamically in the embedded grid?
>> >> 2) The event handler must be in the code-behind code that uses the
>> >> custom
>> >> built DataGridColumn and should not be in the DataGridColumn code
>> >> itself.
>> >> 2) How do I figure out in that one event handler method, the drop down
>> >> list
>> >> that threw the event, and the value of the selected item.
>> >
>> > You can have the dropdownlist raise the SelectedIndexChanged event and
>> > then
>> > trap the event (in the codebehind of the Page class, as you wanted)
>> > using
>> > Event Bubbling. Lookup for samples on Event Bubbling on the MSDN
>> > library.
>> >
>> > Consider though the size of the downloaded page. If every row of your
>> > DataGrid were to repeat the same data for the dropdownlist then your
>> > page
>> > can
>> > easily run over 1 megabyte in size (when handling real data). I would
>> > either:
>> >
>> > 1. Add an EditCommandButton in the DataGrid and leave the
>> > DropDownList
>> > in
>> > the EditItemTemplate of one column. The DropDownList will only be
>> > displayed
>> > in one row at a time when you bind it to its DataSource (this happens
>> > during
>> > your handling the EditItem event). In this scenario the Update button
>> > would
>> > raise the ItemCommand event. In processing the ItemCommand event you
>> > can
>> > get
>> > both:
>> >
>> > a. The ItemIndex of the grid where the postback occurred:
>> > e.Item.ItemIndex, and
>> > b. A reference to the dropdown list:
>> > (DropDownList)e.Item.Cells[x].Controls[0]
>> > (where x = the column no).
>> >
>> > 2. Replace the DropDownList by a TextBox and use client-side
>> > Javascript
>> > to transform an xml data document using xslt to display a list of
>> > matching
>> > results as demonstrated on this page:
>> >
http://www.societopia.net/samples/textbox.htm
>> >
>> > --
>> >
http://www.webswapp.com
>> >
http://www.societopia.net
>> >[/color]
>>
>>
>>[/color][/color]