troubleshooting Question

How to access selected index of a DropDownList within a repeater asp/net c#

Avatar of Codingitup
Codingitup asked on
3 Comments1 Solution426 ViewsLast Modified:
I all,

I've got the following code from a pervious example: -

        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)           

            int SelectedIndex = 0;
            var controls = Repeater1.Items.Cast<RepeaterItem>()
            .Where(t => t.ItemType == ListItemType.Item || t.ItemType == ListItemType.AlternatingItem)
            .Select(t => t.FindControl("cmbReturnStage"));

there is a control called cmbReturnStage that I need to set the selected index based on a variable ie: -

cmbReturnsStage.Selectedindex = varSelectedIndex;

How do I gain control over the DropDownList of the individual row in the repeater to set it's selectedIndex please?

Many Thanks

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
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 3 Comments.
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