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

Get label text when dropdownlist is changed

I have a datagrid containing one TemplateColumn with a label
(lblObjectID) and one TemplateColumn with a DropDownList.

When the DropDownList is changed I want to capture the value in the
TemplateColumn with the label. How can I do that?

I'm using the following code:

Private Sub ddContract_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs)

Dim strContractID As String = CType(sender,
DropDownList).SelectedItem.Value
Dim strObjectID As String = ???

End If

Regards,

S

Nov 2 '06 #1
1 2601
Try using ItemCommand event. If I am not mistaken, it should fire on the ddl
selection change. Through the event's second parameter you can get to the
item (row), from item to the cell with the label and FindControl on the
cell.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<st****@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
>I have a datagrid containing one TemplateColumn with a label
(lblObjectID) and one TemplateColumn with a DropDownList.

When the DropDownList is changed I want to capture the value in the
TemplateColumn with the label. How can I do that?

I'm using the following code:

Private Sub ddContract_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs)

Dim strContractID As String = CType(sender,
DropDownList).SelectedItem.Value
Dim strObjectID As String = ???

End If

Regards,

S

Nov 2 '06 #2

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

Similar topics

2
by: Dot net work | last post by:
Hello. I have an aspx page that changes an HTML label's text using javascript. After the label's text has been changed in this way, I redirect to another aspx page. If I then use the back...
3
by: Jason | last post by:
I am new to WebForms and am far more comfortable with WinForms. I am wondering how simple things such as showing/hiding a label and textbox can be accomplished if a certain Radiobutton option is...
0
by: needin4mation | last post by:
Hi, consider this snippet, please: private void dgdHistory_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { string city=null; if...
1
by: Paul Aspinall | last post by:
Hi I'm using a FormView control. In my EditTemplate, I have bound to a DropDownList. This works fine, by having the key in my primary table, which is looked up via the binding to my DDL using...
3
by: Dominique | last post by:
Hello, I tried: <aw:HyperLink runat="server" id="hlQueuedCount" labelposition="top" labelwidth="30" command="runQuery" /> as if I use the parameter width it just affect the result of the query...
2
by: rn5a | last post by:
Consider the following code: <script runat="server"> Sub ShowData(obj As Object, ea As EventArgs) lblDate.Text = DateTime.Now.ToString("d") lblDate.DataBind() End Sub </script> <form...
2
by: Igor | last post by:
Hi I build a page that has a dropdownlist control bound with data from a database. When user select an item from the dropdownlist I want a label to be filled with a result from a stored...
0
by: mesut | last post by:
Hi colleagues, I've a very strange problem here. I have no clue whyt it happens. I have a listview. The Listview populates well. I have an Update Button in the listview and a...
0
by: Czechtim | last post by:
Hello, I have problem with databinding. I created small application using structure that I need to demonstrate problem. I need to change content of label when changing content of property...
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: 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:
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.