troubleshooting Question

set selectedindex of a DropDownList within a repeater. C#

Avatar of Codingitup
Codingitup asked on
1 Comment1 Solution860 ViewsLast Modified:
Hi All,

I've got the following code within a repeater control: -

                    <asp:Repeater ID="Repeater1" runat="server" 
                        DataSourceID="sqlDBGetRoutingPath" ClientIDMode="Static" 
                        <table border="0" cellpadding="0">

                            <tr align="center">
                                <td rowspan="2" style="background-color: #FFCC00; width: 189px; border-bottom-style: groove;">
                                    <asp:Label ID="lblRoutingSeq" runat="server" Font-Bold="True" 
                                        Font-Names="Arial Black" Font-Size="XX-Large" Text="0"></asp:Label>
                                <td rowspan="2" style="background-color: #CCCCCC; width: 380px; border-bottom-style: groove;">
                                    <asp:DropDownList ID="cmdStage" runat="server" Width="95%" BackColor="White">
                                <td rowspan="2" style="background-color: #CCCCCC; width: 380px;; border-bottom-style: groove;">
                                    <asp:DropDownList  ID="cmbReturnStage" runat="server" Width="95%" BackColor="White" DataSourceID="sqlDBStages" DataTextField="Stages" 
                                <td style="background-color: #CCCCCC; width: 80px;">
                                    <asp:CheckBox ID="chkMating" runat="server" Text="Mating" />
                                <td style="background-color: #CCCCCC ; border-bottom-style: groove;"">
                                    <asp:ImageButton ID="cmdMoveUp" runat="server" Height="24px" 
                                        ImageUrl="~/Images/up.png" Width="24px" />
                                    <asp:ImageButton ID="cmdMoveDown" runat="server" Height="24px" 
                                        ImageUrl="~/Images/down.png" Width="24px" />
                                    <asp:ImageButton ID="cmdDelete" runat="server" Height="24px" 
                                        ImageUrl="~/Images/gtk_cancel.png" Width="24px" />



There is a repeated control called cmbReturnStage which is a DropDownList. They are all populated by a certain list. I've got another bit of code that will set the selectedindex of the drop down list but how do I go about setting the SelectedIndex property please when it is within a repeater.

Many Thanks
Habib Pourfard
Senior Software Engineer
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros