473,324 Members | 2,166 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,324 software developers and data experts.

Capturing an event within a template column

All,
I have a simple datagrid with one column being a template column that
contains a dropdown control. I'd like to be able capture when the
index of the dropdown changes and access the value that has been
selected. I've tried the datagrid's itemcommand event but it doesn't
fire when the dropdown selection changes. Here is the closest solution
I could come up with using the onchange event:

Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal
e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound

If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
Dim oDD As DropDownList = e.Item.FindControl("cboChoose")
oDD.Attributes.Add("onchange", "alert('" &
oDD.SelectedItem.Text & "');")
End If
End Sub

The only problem is, the SelectedItem.text value in the "alert" is
being generated as each column is bound, so it's always returning the
initial value. Anyone have any ideas on how to properly manage a
dropdown changed event within a template column? This seems like it
shouldn't be difficult, but several google searches have yielded
nothing.

Thanks.
Nov 18 '05 #1
0 939

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

Similar topics

2
by: thomaz | last post by:
Hi; How can i store the content of one DataGrid cell in a String Variable? Thanks....
1
by: Jonah Olsson | last post by:
Hello, I'm trying to build an "add-on" to an already existing custom web user control. The old control collects some user data and saves it to a database. The new control should collect some...
3
by: Tina | last post by:
I have an ascx control in the ItemTemplate of a Template Column in a datagrid. The control (myControl) raises an event. I'm trying to figure out how I can subscribe to the event. It can't be...
5
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event...
4
by: tneufeld | last post by:
I am using a ListView control to display 2 columns of data that I populate manually. I can get the data in the first column easily enough. its when i try to get the data in the second column...
2
by: Hardy Wang | last post by:
Hi all, We have DataGrid control in Web Form, our client requires to be able to click anywhere of a row to fire the event same as LinkBotton column is clicked. We we did in ASP.NET 1.1 is in...
3
by: MLM450 | last post by:
I have a control that handles the KeyDown event but it does not seem to execute when a combination of keys is pressed - like CTRL+Z. If I press CTRL, it executes. If I press Z, it executes. But the...
3
by: ghostrider | last post by:
Does anyone know how to recognise the image capture signal from a medical scope such as a video colonoscope? I've got video streaming from the scope to the computer but want my app to recognise...
3
by: =?Utf-8?B?SmFtZXMgTGVubm9u?= | last post by:
I have a gridview that has a button column and a template column with another button in it. When I click on the button column button I can get the row index in the event handler for the...
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
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: 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...
1
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
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...

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.