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

Capture onselectedindexchange from nested dropdownlist

I have a repeater control with a DropDownList in the header template. I am trying to make a database call and sort the results by the selectedIndex property of the drop down. The SelectedIndexChanged event is not getting fired, feel like I've tried everything.

Repeater Code
************************************************** ************************************************** ******************************
<asp:Repeater ID="rptRecords" OnItemCreated="rptRecords_OnItemCreated" runat="server">
<HeaderTemplate>
<table class="bordered" Width="100%" align="center" cellpadding="2">
<tr class="header_row">
<th class="h_12" colspan="19" align="left">
<asp:Label ID="lblTitle" Text="" CssClass="h_12" runat="server" />
</th>
</tr>
<tr>
<td colspan="19" align="right">
Sort by:&nbsp;
<asp:DropDownList
OnSelectedIndexChanged="ddlSort_SelectIndexChanged "
ID="ddlSort"
AutoPostBack="true"
runat="server">
<asp:ListItem Text="Project ID" Value="M.OBID" />
<asp:ListItem Text="Project Type" Value="ProjectType" />
<asp:ListItem Text="TPM Team" Value="TPMTeam" />
<asp:ListItem Text="InfrastructureType" Value="InfrastructureType" />
<asp:ListItem Text="Priority" Value="Priority" />
<asp:ListItem Text="Status" Value="Status" />
<asp:ListItem Text="Phase" Value="M.DMAIC" />
<asp:ListItem Text="Disposition" Value="Disposition" />
</asp:DropDownList>
</td>
</tr>
</HeaderTemplate>

Non working code
************************************************** ************************************************** *****************************
protected void rptRecords_OnItemCreated(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Header)
{
DropDownList ddlSort = (DropDownList)e.Item.FindControl("ddlSort");
ddlSort.AutoPostBack = true;
ddlSort.SelectedIndexChanged += new EventHandler(dropDownList_SelectedIndexChanged);
}
}

protected void dropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
RepeaterItem rptItem = (RepeaterItem)(((Control)sender).NamingContainer);
DropDownList ddlSort = (DropDownList)rptItem.FindControl("ddlSort");
m_SortExpression = ddlSort.SelectedValue;
LoadData();
}
Mar 29 '07 #1
0 1178

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: steve roszko | last post by:
I have a dropdownlist in a column of my datagrid. When the user changes the value in the ddl, I want to fire off OnSelectedIndexChange event and do an update based on the id held in a hidden...
2
by: Greg Fischer | last post by:
I need to access the properties of a control that is nested in 2 datalists. How do you use findcontrol method to do that? what I have is like this: <asp:datalist id="dlist" runat="server">...
5
by: glenn | last post by:
Hi folks, If I want to select the first item in a DropDownList, I need to first select any item other than the first item and then next I select the first item which will then fire an event...
6
by: Steve Hershoff | last post by:
Hi everyone, I've got a strange one here. There are two datagrids on my page, one nested within the other. I'll refer to them as the topmost and secondary datagrids. In the topmost...
0
by: sgtmarcjones | last post by:
How do I access a dropdownlist that is nested within a Formview ItemTemplate Gridview Template? I want to see a label (lgbTimeKeep ! TextValue of ddlName dropdownlist) instead of a dropdownlist...
0
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box...
2
by: MattB | last post by:
I have a (.Net 1.1) form with a Repeater and a DropDownList in the ItemTemplate. I programmatically make the DDL Autopostback = true at runtime based on the bound data. That works - I can see the...
5
by: John Kotuby | last post by:
Hi all, After more than a year programming with ASP.NET 2.0 and VB I am still finding it difficult to leave some habits from classic ASP behind. this is particularly true with cross-page posting....
6
by: RobertTheProgrammer | last post by:
Hi folks, Here's a weird problem... I have a nested GridView setup (i.e. a GridView within a GridView), and within the nested GridView I have a DropDownList item which has the...
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...
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...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.