473,320 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

raise a bubble event.

Hi

I am trying to raise a bubble event.

I have a dropdownlist and a datalist in a datalist.

I want to use the postback from the dropdownlist to rebind the nested
datalist. But i need the event to be a datalist Command so i have
access to e.item for the main datalist

the aspx code

<asp:datalist id=PostageGroups
OnSelectedIndexChanged="ddlGroupStatus_SelectedInd exChanged"
AutoPostBack="True" ' etc...
<ItemTemplate>
'my dropdown for picking the status
'of the items to be listed in
<asp:dropdownlist id=ItemStatus ...
</asp:dropdownlist>
'nested datalist
<asp:datalist id=PostageItems
'some more code...
</asp:datalist:asp>
</ItemTemplate>
</asp:datalist>

i am trying to catch the datalist PostageGroups postback for the
dropdownlist ItemStatus so i can rebind the rested datalist

the aspx.vb code:

Public Event Command As
System.Web.UI.WebControls.CommandEventHandler

Protected Overridable Sub OnCommand(ByVal e As
System.Web.UI.WebControls.CommandEventArgs, ByVal source As Object)

RaiseEvent Command(source, e)

RaiseBubbleEvent(source, e)

End Sub

Public Sub ddlGroupStatus_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs)

OnCommand(New
System.Web.UI.WebControls.CommandEventArgs("DropDo wn", CType(sender,
DropDownList).SelectedValue), CType(sender, DropDownList))

End Sub

Private Sub PostageTypes_ItemCommand(ByVal source As Object,
ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs ) Handles
PostageTypes.ItemCommand

If e.CommandName = "DropDown" Then

Dim GroupID As Integer =
CType(CType(e.Item.FindControl("lblDeliveryGroupID "), Label).Text,
Integer)
Dim Status As Boolean =
CBool(CType(e.Item.FindControl("ddlGroupStatus"),
DropDownList).SelectedValue)
Dim myPostage As New Ecom_PostageDB

With CType(PostageTypes.FindControl("PostageList"),
DataList)
..SelectedIndex = -1
..DataSource =
myPostage.GetPostageItemsByStatusAndGroup(Status, GroupID)
..DataBind()
End With

End If

Nov 18 '05 #1
1 4344
Hi Lucifer,

When the DropDownList fires a SelectIndexchanged event, the sender
parameter in the event handler will represent the DropDownList. You
can use the Parent property of the DropDownList to get back to the
DataListItem, and from there grab the nested DataList (perhaps with
FindControl).

I have two articles that could help you. They deal with DataGrid and
Repeaters, but the approach is the same.

DropDownList Controls In an ASP.Net DataGrid
http://odetocode.com/Articles/231.aspx

In Search Of ASP.NET Controls
http://www.odetocode.com/Articles/116.aspx

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 13 Oct 2004 07:34:13 -0700, "Lucifer" <rs******@zethics.com> wrote:
Hi

I am trying to raise a bubble event.

I have a dropdownlist and a datalist in a datalist.

I want to use the postback from the dropdownlist to rebind the nested
datalist. But i need the event to be a datalist Command so i have
access to e.item for the main datalist

the aspx code

<asp:datalist id=PostageGroups
OnSelectedIndexChanged="ddlGroupStatus_SelectedIn dexChanged"
AutoPostBack="True" ' etc...
<ItemTemplate>
'my dropdown for picking the status
'of the items to be listed in
<asp:dropdownlist id=ItemStatus ...
</asp:dropdownlist>
'nested datalist
<asp:datalist id=PostageItems
'some more code...
</asp:datalist:asp>
</ItemTemplate>
</asp:datalist>

i am trying to catch the datalist PostageGroups postback for the
dropdownlist ItemStatus so i can rebind the rested datalist

the aspx.vb code:

Public Event Command As
System.Web.UI.WebControls.CommandEventHandler

Protected Overridable Sub OnCommand(ByVal e As
System.Web.UI.WebControls.CommandEventArgs, ByVal source As Object)

RaiseEvent Command(source, e)

RaiseBubbleEvent(source, e)

End Sub

Public Sub ddlGroupStatus_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs)

OnCommand(New
System.Web.UI.WebControls.CommandEventArgs("DropD own", CType(sender,
DropDownList).SelectedValue), CType(sender, DropDownList))

End Sub

Private Sub PostageTypes_ItemCommand(ByVal source As Object,
ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs ) Handles
PostageTypes.ItemCommand

If e.CommandName = "DropDown" Then

Dim GroupID As Integer =
CType(CType(e.Item.FindControl("lblDeliveryGroupI D"), Label).Text,
Integer)
Dim Status As Boolean =
CBool(CType(e.Item.FindControl("ddlGroupStatus" ),
DropDownList).SelectedValue)
Dim myPostage As New Ecom_PostageDB

With CType(PostageTypes.FindControl("PostageList"),
DataList)
.SelectedIndex = -1
.DataSource =
myPostage.GetPostageItemsByStatusAndGroup(Statu s, GroupID)
.DataBind()
End With

End If


Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lucifer | last post by:
Hi I am trying to raise a bubble event. I have a dropdownlist and a datalist in a datalist. I want to use the postback from the dropdownlist to rebind the nested datalist. But i need the...
0
by: Lucifer | last post by:
Hi I am trying to raise a bubble event. I have a dropdownlist and a datalist in a datalist. I want to use the postback from the dropdownlist to rebind the nested datalist. But i need the...
5
by: Mike | last post by:
Hi group; Let say I have an object called Account, that raises an event called AccountLow with its owns EventArgs, and when this event gets raised, I will like to raise another custom...
0
by: shapper | last post by:
Hello, I have a few custom controls organized as follows: Parent Child Section User User control raises an event named Updated. This event has custom arguments of type UpdatedEventArgs.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.