Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 88045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:29:53+00:00 2026-05-10T22:29:53+00:00

Greetings! I have a DropDownList within a FormView which are bound to XmlDataSources: <asp:FormView

  • 0

Greetings!

I have a DropDownList within a FormView which are bound to XmlDataSources:

<asp:FormView ID='MyFormView' runat='server' DataSourceID='MyXmlDataSource'>     <ItemTemplate>         <h1><%# XPath('SomeNode')%></h1>         <asp:Label ID='MyLabel' runat='server' AssociatedControlID='MyDdl' Text='<%# XPath('SomeOtherNode')%>' />         <asp:DropDownList ID='MyDdl'                           runat='server'                           DataSourceID='MyDdlDataSource'                           DataTextField='name'                           DataValueField='value'                           AutoPostBack='true'                           OnSelectedIndexChanged='MyDdl_SelectedIndexChanged'>         </asp:DropDownList>     </ItemTemplate> </asp:FormView> <asp:XmlDataSource ID='MyXmlDataSource' runat='server' XPath='Root/MainSection' /> <asp:XmlDataSource ID='MyDdlDataSource' runat='server' XPath='Root/MainSection/Areas/*' /> 

In the page’s codebehind, I have the following OnLoad() method as well as the method for when the select index of the dropdownlist changes:

protected override void OnLoad(EventArgs e) {     base.OnLoad(e);      if (!IsPostBack)     {         string xml = GetMyXml(0); // default value         MyXmlDataSource.Data = xml;         MyDdlDataSource.Data = xml;     } }  protected void MyDdl_SelectedIndexChanged(object sender, EventArgs e) {     DropDownList l_MyDdl = FindControl('MyDdl') as DropDownList;     int myVal;     if (l_MyDdl != null)         if (!Int32.TryParse(l_MyDdl.SelectedItem.Value, out myVal))             myVal = 0;     string xml = GetMyXml(myVal);     MyXmlDataSource.Data = xml;     MyDdlDataSource.Data = xml; } 

When a different value is selected from the dropdown list and SelectedIndexChanged is invoked, I am unable to get the value of the dropdown list (FindControl always returns null) in order to use it to re-bind the datasources. How can I get this value?

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:29:53+00:00Added an answer on May 10, 2026 at 10:29 pm

    Because your dropdownlist is contained within another control it may be that you need a recursive findcontrol.

    http://weblogs.asp.net/palermo4/archive/2007/04/13/recursive-findcontrol-t.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings! I have a Repeater control that's using an XmlDataSource control. <asp:FormView id=myFormView runat=server
Greetings, I have asp.net check box control and asp.net dropdownlist control inside div tag.
Greetings! I have a simple navigation menu consisting of an asp:DropDownList and an asp:Button.
Greetings, I have a particular object which can be constructed from a file, as
Greetings - I have a SharePoint 2010 server running with the User Profile service
greetings all i have a problem that when sending an email from the server
Greetings, I have an asp.net mvc application. I have some links that corresponds to
Greetings, I have a large .Net web app which runs on a farm of
Greetings All; I have a LinkedList of type String which contain some words like
Greetings I have a Main Window which will hold multiple User Controls. I will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.