473,378 Members | 1,319 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,378 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 4348
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.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.