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

dropdownlistbox in a datagrid

I have a dropdownlistbox in a template column of a datagrid. I need to be able to respond to the selecteditemchanged event of the dropdownlist, but I am having trouble doing that. I thought I would be able to use the OnItemCommand event, but that doesn't seem to work. Can someone please point me in the right direction if this can be done?
Nov 18 '05 #1
2 1242


"Mike" wrote:
I have a dropdownlistbox in a template column of a datagrid. I need to be able to respond to the selecteditemchanged event of the dropdownlist, but I am having trouble doing that. I thought I would be able to use the OnItemCommand event, but that doesn't seem to work. Can someone please point me in the right direction if this can be done?

Nov 18 '05 #2
Hello Mike
I hope this code will help you

public void getSelectedValue()
{
DropDownList dd ;

for(int i = 0; i < dGrid.Items.Count ; i++)
{
dd = new DropDownList();

dd= ((DropDownList)dGrid.Items[i].FindControl("ddlTrackingBy"));
string b = dGrid.Items[i].Cells[2].Text;

for(int j = 0 ; j <dd.Items.Count ; j++)
{

if(dd.Items[j].Text == b)

{
dd.SelectedIndex = j;

}

}

}
}

using htis code u could easily get selected index or value
"Mike" wrote:
I have a dropdownlistbox in a template column of a datagrid. I need to be able to respond to the selecteditemchanged event of the dropdownlist, but I am having trouble doing that. I thought I would be able to use the OnItemCommand event, but that doesn't seem to work. Can someone please point me in the right direction if this can be done?

Nov 18 '05 #3

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

Similar topics

0
by: Max | last post by:
Have a DropDownListBox where I want to give users the option to select one of the values, but allow them to enter a freeform text value if they choose to do so in lieu of the proffered values. Kind...
7
by: Eduardo M?ndez | last post by:
Hello: I have an aspx page with a TextBox and a DropDownListBox both have Autopostback property set to true and some code in the TextChanged and SelectedIndexChanged events. When text in...
2
by: kgs | last post by:
I dynamically added a DropDownListBox to a footer of datagrid on itemcreated event. In which event in postback can i access the selected item. Interesting thing i noted that even though i create...
4
by: | last post by:
I think we have some bug in dropdownlistbox server control. Following are the values. <asp:DropDownList id="DropDownList1" runat="server"> <asp:ListItem value="46">INR</asp:ListItem>...
1
by: pari kanaga | last post by:
I have server control dropdownlistbox populated with data from table. I don't know how to make this dropdownlistbox searchable. ( for example if i click the dropdownlistbox and type the name it...
1
by: raj | last post by:
hello i want to set the tooltip of data displaying in dropdownlistbox , i have bound the dropdownlistbox with datasource and i want that tooltip shld be display at every item of dropdownlistbox...
2
by: Kenichi666 | last post by:
I am new to ASP.NET and C#. I have populate a dropdownlistbox from a sqltable. I would like to set the selected value in the dropdownlistbox to an sql UPDATE command. like fx. "UPDATE name =...
1
by: jeyapriya | last post by:
Dear Friends This is Jeyapriya. Right now I am working in the ASP.NET with VB coding & the back end is SQL SERVER 2000. My dilemma is I have to design a form with 2 DropDownListboxes. I have...
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: 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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.