3 Replies - 5089 Views - Last Post: 03 August 2010 - 10:12 AM Rate Topic: -----

#1 priya Shetty  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 02-August 10

Drop Down List(Parent and Child)

Posted 02 August 2010 - 08:56 PM

Hi all..
I need to create a simple drop down list(parent and child) using ASP.NET and MSSQL..
When select an object in parent drop down list i want child drop down list select for their own list...

like..2 column
| name | school |
| Priya| High School|

when select name "priya" in parent drop down list i want child drop down list select "High School" Automatically...

How i can make it?Help me friends... :flowers:

This post has been edited by priya Shetty: 02 August 2010 - 08:59 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Drop Down List(Parent and Child)

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: Drop Down List(Parent and Child)

Posted 02 August 2010 - 09:50 PM

do you mean when selecting one item in the list, the other dropdown selects the same index? if so, you could do something like this...

DropDownList2.SelectedIndex = DropDownList1.SelectedIndex;


Was This Post Helpful? 0
  • +
  • -

#3 Frinavale  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 203
  • View blog
  • Posts: 776
  • Joined: 03-June 10

Re: Drop Down List(Parent and Child)

Posted 03 August 2010 - 08:41 AM

Set DropDownList1's AutoPostback property to "True".
Then handle the DropDownList1's SelectedIndexChanged event. When you write the code for this method, specify which index should be selected in DropDownList2 depending on the value selected in DropDownList1 (just like eclipsed4utoo was trying to get at).

-Frinny
Was This Post Helpful? 1
  • +
  • -

#4 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: Drop Down List(Parent and Child)

Posted 03 August 2010 - 10:12 AM

View PostFrinavale, on 03 August 2010 - 11:41 AM, said:

Set DropDownList1's AutoPostback property to "True".
Then handle the DropDownList1's SelectedIndexChanged event. When you write the code for this method, specify which index should be selected in DropDownList2 depending on the value selected in DropDownList1 (just like eclipsed4utoo was trying to get at).

-Frinny


yeah...posting at 1AM, I seemed to have forgotten to post the rest of the code. :sleep1:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1