473,386 Members | 1,886 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,386 software developers and data experts.

Reference - adding an event to a dropdownlist in a repeater control - asp.net

I did not find code for adding an event to dropdownlist in a repeater
control posted anywhere. So, I am posting it for the next person
(sorry if this seems obvious to you):

''''''''''''''''''''
Private Sub MyRepeater_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
MyRepeater.ItemCreated

Dim strValue As String
Dim objCTL As Control

For Each objCTL In e.Item.Controls
strValue = objCTL.GetType.ToString
If strValue = "System.Web.UI.WebControls.DropDownList"
Then
' 'add the click event and point to existing click
event
Dim objDDL As DropDownList = DirectCast(objCTL,
DropDownList)
AddHandler objDDL.SelectedIndexChanged, AddressOf
ddlINFO_SelectedIndexChanged
End If
Next

End Sub

Private Sub ddlINFO_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles ddlMapTarget.SelectedIndexChanged

'note make sure that ddlINFO has a autopostback="True" for for
this work

Dim objDDL As DropDownList = CType(sender, DropDownList)

lblMessage.Text = objDDL.SelectedValue()
lblMessage.Visible = True

End Sub
''''''''''''''

Phin
Nov 18 '05 #1
0 1202

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

Similar topics

4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
0
by: mrwoopey | last post by:
I did not find code for adding an event to dropdownlist in a repeater control posted anywhere. So, I am posting it for the next person (sorry if this seems obvious to you): ''''''''''''''''''''...
1
by: Ravi | last post by:
Hi, I have a radio button list and a dropdownlist inside a repeater control. Want to hide or display the dropdownlist based on selection in radiobuttonlist. I can add the...
6
by: WebMatrix | last post by:
Hello, Here's the situation (I'll try to be brief as possible) I am working on the control which is created dynamically based on XML string. This control consists of a table with number of rows...
1
by: Joe Gass | last post by:
I'd like to bind some xml to a dropdownlist <engines> <engine name="test1" id="1" /> <engine name="test2" id="2" /> </engines> If I do: ddlEngines.DataSource =...
4
by: TS | last post by:
I am creating a User control and i create some dynamic controls in the init handler. one of the controls is a custom validator which i assign a serverValidate event handler. I usally always do my...
6
by: Totto | last post by:
Hi, Anyone know the best solution to dynamically add buttons to a asp 2.0 page using data from Sql server? Are there any contols suitable for this or is it best to iterate the dataset and...
11
by: J055 | last post by:
Hi I have a dropdown control which is constructed in another dropdown control SelectedIndexChanged event protected void ddlParamType_SelectedIndexChanged(object sender, EventArgs e) { //...
3
by: =?Utf-8?B?RGVlcGE=?= | last post by:
Hi All, I have a webform in asp.net framework 1.1 where the dropdownlist is populated with list of locations from the database. The depending on the list selected, the user will be able to see...
7
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm adding subheadings to a gridview. Each sub head has a few link buttons. I'm adding the controls in the rowdatabound event code follows: sorry about the length here. I have to be missing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.