.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
satyapriyanayak
Kaviya Balasubramanian
SP
abhays
Sasi Prabhu
Post New Web Links

how to populate a dropdown box based on selectedvalue in another dropdown/combo box

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net
 

Hello,

I am new to MVC.  Can anyone show me how to populate a dropdown list box based on selected value in another

dropdown list box?  Say, for example, the first dropdown is a list of car manufactures.  When a user selected a manufacture from that dropdown list, the second dropdown would list would automatically gets populated with all the car models for that manufacture. 

Any help is greatly appreciated.

 

 




View Complete Post


More Related Resource Links

populate dropdown based on attribute criteria

  
Trying to load a dropdown list with the 'name' attribute from the category node...must be missing something: The xml: <Settings>  <department name="Accounting">    <category name="Bank Information">    <category name="Form Information"></Settings>    The code I'm attempting: XmlDocument settingsdoc = new XmlDocument();                settingsdoc.Load(Server.MapPath("/XML/Settings.xml"));                XmlNodeList nodeList = doc.SelectNodes("Settings/department[name='Accounting']");                 foreach (XmlNode node in nodeList)                    CategoryDDL.Items.Add(new ListItem(node.SelectSingleNode("//department/category[name]").InnerText)); CategoryDDL.DataBind();   Any idea what looks wrong? Thanks!

how to hide/display controls in NewForm.aspx based on dropdown value in SharePoint list

  

Hi,

I have 1 dropdown in my sharepoint list with other columns. If dropdown value equal to 'xyz' i need to display some other controls, otherwise these controls should be hidden.

I know we can achieve this with javascript. If any one can provide code or sample then it will be appreciated. or is there any other alternative methods to do this ........


Thanks & Regards, Neerubee

On New Item form, select item on choice dropdown based on query result.

  

I posted this on Experts Exchange awhile back with no answer, so here's hoping someone here has an idea :)

So I've mostly figured this problem out, but I need some help in getting over the hump... note that I'm using JavaScript to do this (SPServices) on SharePoint 07'.

I'm on the New Items page of a list. Based on a user's selection in a "Teacher" dropdown, I'm doing the following:

1.) Get the value of the Teacher field and several other fields (School and Visit Date)
2.) Run a CAML query based on those fields to find the last list item entered for that Teacher

So here's where I'm stuck...

I have 10 choice fields, all with choices 0, 4, 7, and 10. Depending on what they were set to in the last entered item (which I queried), I want to set the selected item on each of those dropdowns to equal that. So "Score 1" was set to "4" on the la

Populating dropdown based on checkbox value in Infopath

  
Hi I have created a form library with the following values ID  Document   Preference 1   A                Yes 2   B                No 3   C                Yes   I have a drop-down and a checkbox in an infopath form. This dropdown will by default display the ID numbers. When a user checks the checkbox, then the dropdown should display only the id's that has "Preference" value equal to "Yes". I am using Infopath 2010 How to do this...Any suggestions...

filter a dropdown based on a check box value

  
Hi I created a dropdown in the infopath that will lists all the ID's from a sharepoint list. Then I added a checkbox in the form. When a user selects/checks the check box, the dropdown list should display only the student ID's Sample list I used ID    category 1      student 2      master 3      student 4      student 5      master How to do this. Any ideas, I am new to infopath 2010.

Populating a dropdown box with contents based on the selection of another dropdown box

  
Hi All   I am a complete newcomer to ASP.NET.  However in the few weeks I have been playing with it I have got pretty far and  have mastered things like stored procedures, gridviews, formviews and templates.  I have come across a problem which I am struggling with and could do with some help!  The scenario is this:   I have a dropdown box which is populated from SQLDataSource1   I have a second dropdown box which is populated from SQLDataSource2, but i need the query feeding this to be dependent on what was selected in the first dropdown box.    I assumed it would simply be a case of modifying the select statement on SQLDataSource2 using the SelectedIndexChanged event on the first DropDownList to update the second SQL source, but I cannot work out for the life of me how to do it.  Pretty much all of the code I have is ASP.   Is there a way I can do this purely in ASP rather than using VB behind the scenes or do I need to use VB?  I am pretty comfortable with vb.net but one of the other issues I have is referencing an ASP object from VB... so for instance if I had a text box in ASP, how can I read or change the properties of this object from VB?   FYI I am using Visual Studio 2010 and SQL/Server   Any help much appreciated!!!   Sean   

dropdown list wont populate values from database

  
 

Hello everyone i need help. Ive been having this problem for almost  3 days now. dropdown list won't populate from database

Below is the code i am using:

<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PhotoAlbum.aspx.vb" Inherits="PhotoAlbum" %>

<asp:SqlDataSource ID="categoriesDataSource" runat="server"  
    ConnectionString="
<%$ ConnectionStrings:ConnectionString %>"  
 
 
 
    SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] WHERE ([UserId] = @UserId) ORDER BY [Name]"> 
   
<SelectParameters> 
       
<asp:QueryStringParameter Name="UserId" QueryStringField="ID"/> 
   
</SelectParameters> 
<

Populate in dropdown list control

  

Hello need some help on this one.  I am using ASP.NET with C# and Oracle database. I am trying to return some values from my select statement to fill my dropdown list control. I am designing this in a 3 tier architecture.  Here is my codes.  I am getting an error which states "Object reference not set to an instance of an object." I am returning the field name "NAME" to be filled in my dropdown control.  What I am doing wrong?

 

List.cs file code

public static string _GetClientList()

{

string clients = string.Empty;int SessUserID =

populate day dropdown on month change

  
<script type="text/javascript" language="javascript">
function testDate(value)
{

// var sel = document.forms(0).DDAY;
var sel =document.getElementById('DDAY');

sel.options.length = 0;

var NoOfDays = DaysInMonth(value);
alert(NoOfDays)

for(var i=1;i<=NoOfDays;i++)
{
//create new option
var option = new Option(i, "Value" + i);
sel.options(i) = option;

}
}
</script>


<select onchange="testDate(this.value)" id="MMONTH" style="display: none;
z-index: 101; left: 0px; width: 80px; position: absolute; top: 2px" runat="server">
<option selected="selected" value="01">JAN</option>
<option value="02">FEB</option>
<option value="03">MAR</option>
<option value="04">APR</option>
<option value="05">MAY</option>
<option value="06">JUN</option>
<option value="07">JUL</option>
<option value="08">AUG</option>
<option value="09">SEP</option>
<option value="10">OCT</option&g

Dropdown lists - showing items based on value

  

Hi, i have over 100 items all loaded in a dropdown list. They all are assigned a value between 1-10 which represent 10 categories.

When certain buttons are clicked, i want the dropdown list to display only items with a value "1" or "2", etc.

How can this be done?


Cannot get ForeignKey to populate Dropdown

  

I am using a DynamicData - Entity project.  I have added a DynamicDataManager with AutoForeignKeys = true and also added a EntityDataSource with an include to the associated table.

<asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true" >

<DataControls>

<asp:DataControlReference ControlID="gvContact" />

</DataControls>

</asp:DynamicDataManager>

<asp:EntityDataSource ID="EDS1" runat="server"

ContextTypeName="AR_Data_Model.AREntities"

EntitySetName="AR_DonorContacts"

Include="Ref_Values, Ref_States">

</asp:EntityDataSource>

 

The contacts table has many to one relationship with the Ref_Values and Ref_States table were it shoud retrieve a "text" value for the job title and state.

When the page is ran the gridview returns the integer value that is in the DonorContacts table not the foreign key value.

I have ensured that the relationship exist and that all tables have a primary key.  Also if I set the scaffold to true in the global.asax file and view the DonorContacts table the columns in question display the expected data, not the int.

I can get the correct value by using

Infopath generate URL based off of a selection of a dropdown.

  

Hi,

 

Wondering if anyone had managed this or got any suggestions?

I have a list called terms and conditions, basically has title, and terms meta data.

I want to allow the user in the form to select which t&c are required for the specific request and then on save change it so that the t&c link to the dispform is shown.

 

Now is this something I will have to do purerly in code behind or can this be done with some fancy rules on the form?


exception error in customise dropdown combo

  

i create a user control of dropdown combo, it contains one textbox, datagridview and button.  when i add this dropdown combo (compile to DLL)  to another project, everything running fine, but problem is when i first load the form and try to keyin something in textbox, it comes out error 'object not set to an instance object' ...this error only come out when first load form, if i didn't keyin anything in the textbox but i click the dropdown and select the value, that can work, and if i delete the textbox value and re-keyin , its also ok,  its's just that when i close the form and then load the first time and keyin text, error comes out.

i suspect it is the textbox_textchanged event problem, because when i delete off the code here, its ok, but i can't do that cos i need to do the dataview rowfilter.  below is the sourcecode:

in the usercontrolcombo.designer.cs :

        private System.Windows.Forms.TextBox textBox1;

        public string txtBox
        {
            get { return textBox1.Text; }
            set { textBox1.Text = value; }
        }

 


How To: Filter a link list dropdown field in a form based on Active/Inactive field in the linked li

  

I need to filter a dropdown field on a form that is linked to another list.  The linked list has a field active/inactive and I only want the active ones to show on the form.


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend