Link to home
Start Free TrialLog in
Avatar of Codingitup

asked on

set selectedindex of a DropDownList within a repeater. C#

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" />



Open in new window

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
Avatar of Habib Pourfard
Habib Pourfard
Flag of New Zealand image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial