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 8607337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:19:49+00:00 2026-06-12T03:19:49+00:00

I had trouble getting the value a user selected from a DropDownList. I’ve figured

  • 0

I had trouble getting the value a user selected from a DropDownList. I’ve figured out that I require a postback to get my values to reset and be able to get reassigned. (I’ve tried things like ClientIDMode=”static” in the page control and doing “var dropDownList= $(<%= ddlNewCaseFiles.ClientID %>).val() ) however nothing seems to work. So I implemented this in my header:

    <script runat="server">
    protected void ddlCaseFilesNew_SelectedIndexChanged(object sender, EventArgs e)
    {
        hidNewCaseFile.Value = ddlCaseFilesNew.SelectedItem.Value;
    }
</script>

and it seems to be getting the updated values selected. But for some reason when I click on an item it send me to the “Cannot find Resource” page. I’m guessing if I add an Updatepanel to my DropDownList it will probably fix it?(since it is only posting back my dropDownList). But I am having trouble with it.

this is my DropDownlist:

<div id="ddlFiles">
        <label>
            Select new CaseFile:</label>
        <asp:DropDownList runat="server" ID="ddlCaseFilesNew" DataSourceID="dsCaseFiles"
            DataTextField="Display" DataValueField="FileID" 
            OnPreRender="ddl_PreRender" Width="300px" AutoPostBack="true" 
            onselectedindexchanged="ddlCaseFilesNew_SelectedIndexChanged"/>
    </div>

I’ve tried to implement it here but I’m getting a “UpdatePanel does not have a property name called “dropDownList””. Any help would be great fully appreaciated.:

<asp:UpdatePanel runat="server" ID="UpdatePanel1">
        <asp:DropDownList runat="server" ID="ddlCaseFilesNew" DataSourceID="dsCaseFiles"
            DataTextField="Display" DataValueField="FileID" OnPreRender="ddl_PreRender" Width="300px"
            AutoPostBack="true" onselectedindexchanged="ddlCaseFilesNew_SelectedIndexChanged" />
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ddlCaseFilesNew" EventName="SelectedIndexChanged" />
        </Triggers>
    </asp:UpdatePanel>

Pre_render as requested:

 protected void ddl_PreRender(object sender, EventArgs e)
{
    DropDownList ddl = (DropDownList)sender;
    try
    {
        if (ddl.Items[0].Value != "-1")
            ddl.Items.Insert(0, new ListItem("--Select--", "-1"));
    }
    catch
    {
        ddl.Items.Insert(0, new ListItem("--Select--", "-1"));
    }

}
  • 1 1 Answer
  • 0 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. Editorial Team
    Editorial Team
    2026-06-12T03:19:51+00:00Added an answer on June 12, 2026 at 3:19 am
    if you wanna have it in the update panel 
    
    you should add the  the hidNewCaseFile control inside ContentTemplate  tags
    
    Example : 
    
    
     in the header 
    
      <script runat="server">
            protected void   DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
            {
                hidNewCaseFile.Text = ddlCaseFilesNew.SelectedItem.Value;
            }
    
    
    
        </script>
    
    in the body 
    
    
    
    
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    
            <ContentTemplate>
    
                <asp:Label runat="server" ID="hidNewCaseFile" Text="Label"></asp:Label>
                <asp:DropDownList ID="ddlCaseFilesNew" AutoPostBack="true" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
            <asp:ListItem>Uae</asp:ListItem>
            <asp:ListItem>KSA</asp:ListItem>
            <asp:ListItem>Lebanon </asp:ListItem>
    
    
        </asp:DropDownList>
    
    
    
            </ContentTemplate>
    
    
        </asp:UpdatePanel>
    

    Also make sure that you have <asp:ScriptManager runat="server"> </asp:ScriptManager >

    before you use the update panel

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

Sidebar

Related Questions

This seemed like it should be easy, but I have had trouble getting it
I've had trouble writing this code. I'm supposed to make a function that can
This is something that I have had trouble with in the past and it's
I have had incredible trouble building a binary of ffmpeg for Mac that works
I use DropBox and I've had some trouble reaching to my files from other
I’m having trouble getting a AJAX/JSON function to work correctly. I had this function
I’m having trouble getting a AJAX/JSON function to work correctly. I had this function
I'm having a little trouble getting values out of an XML document. The document
I have had trouble getting web pages to load within Cassini for about a
I've had soooo much trouble getting this code to work properly!!!! It runs fine

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.