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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

cascading drop down lists from single table

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

my one table consists of fields (id, flying from, flying to). thus i have one drop down for flying from and another drop down for flying to. i'm hoping to cascade them so 2nd drop down values are dependant on the values from 1st drop down. is it possible to do this using a single table? or must i use two tables and link the id's from both? and do i write anyting in the SelectedIndexChange event? thanks...

the sqldatasource code looks like this:

Flying From:

        <asp:DropDownList ID="ddlFlyingFrom" runat="server" DataSourceID="SqlDataSource1"
            DataTextField="FlyingFrom" DataValueField="Id" AutoPostBack="True" OnSelectedIndexChanged="ddlFlyingFrom_SelectedIndexChanged">

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestConnectionString %>"
            SelectCommand="SELECT [Id], [FlyingFrom] FROM [Flights]"></asp:SqlDataSource>

View Complete Post

More Related Resource Links

Multiple Cascading Drop Down Lists - Browser



We have a requirement to implement quite a complex cascading drop down list solution. I am aware that there are numerous articles on how to do this however I would like to confirm if it is possible to achieve the following:

1. A drop down list with multiple selections for field A. User selects field A.
2. Field B is automatically populated based on field A which was selected above.
3. A filtered drop down list appears for field C. This filtered drop down list is based on field A & B which was previously selected. User selects field C.
4. Field D is automatically populated based on field C which was selected above.
5. Field E is automatically populated based on field C which was selected above.
6. Field F is automatically populated based on field C which was selected above.

My programming skills are very limited and how I would ideally like to connect the form to a list in SharePoint so that the values can be easily maintained. We are using a browser form and would appreciate any ideas or suggestions on how to create the above functionality. Just out of interest, The custom drop down list for field C will probably have 100 values and overall we have about 5000 records which need to be autopopulated and filtered.

Thanks for any help


merging multiple tables in a single dataset to single table


 i have a stored procedure which returns three tables to a dataset ..... now i need to merge all three tables to a single table from d same dataset 

like dataset1 has table1 table2 and table3 .... i want all the three tabels to be merged into dataset1 itself .... instead of three diffrent tables so that i can show all three table data in a single datagrid  as a compact data and combination of 3 tables from d single dataset.....

can some1 help me please.....

Create a placeholder for drop down lists


First time post here, if i'm in the wrong area please move as necessary. Thanks

I'm using VWD with a database back end. I have a list of teams which are marked off by league, level, division, teamid and then using gridview for the list of players per teams.

I've got the drop downs working correctly but running into a little snag and that is on the auto postback.

When I only have one option come up in a list, i obviously don't change that list and thus it doesn't change the next drop down because there is no post back. is there a way to use a "header" value?

Example of my data

League Level Division Team

NHL 1 West Vancouver
NHL 1 West Calgary
NHL 1 West Edmonton
NHL 1 Central Chicago

OHL 2 West London
OHL 2 West Guelph

NBA 1 Central Chicago
NBA 1 Central Detroit
NBA 1 Central Milwaukee

So my drop downs choose by league, then level then division and then team then shows the player roster for that selected team.

The problem I run into is when only one value exists based on the previous choices I've made. If I choose NHL then Central only Chicago shows up in the example above. Because I'm not choosing between it and another value, the drop down does not put in a post back and thus I don't get a list of the team and then the players

Ajax Cascading drop down method error 500!


Sorry to trouble you all with something that has already been posted a million times but I have tried everything I can and stuck with for about 10 days now. Please help. I have created 2 tables Categories, Subcategories.

Categories table has Category_ID(Primary Key) and "Category" fields. Subcat table has SubcatID(Primary Key, Sub_cat and Category_ID(Foreign Key). Here's the code of the asmx file.

Service methods used in ASPX file ServiceMethod="GetVendors" and ServiceMethod="GetContactsForVendor". Please help me find the source of the method erro 500 and I will be very greatful.

<%@ WebService Language="VB" Class="CascadingDropdown1" %>

Imports System.Web.Script.Services

Imports AjaxControlToolkit

Imports System.Web

Imports System.Web.Services

Imports System.Web.Services.Protocols

Imports System.Collections.Generic

Imports System.Collections.Specialized

Imports System.Data.SqlClient

<ScriptService()> _
Public Class CascadingDropdown1
Inherits System.Web.Services.WebService

<WebMethod()> _
Public Function GetVendors(ByVal knownCategoryValues As String, ByVal category As String) As Cascadi

How can I Set default value for drop down list filled with Cascading

Hi AllI've this problem, how can I set the default value for drop down list filled with cascading. I can't catch the event that came after cascading to set the default value and I can't call any control in this function:  "AjaxControlToolkit.CascadingDropDownNameValue[]"   I've passed the Drop down list as a session and the default value in session   When I call the session of "Drop Down List" the session value Is NULL in this function:  "AjaxControlToolkit.CascadingDropDownNameValue[]"   Any help please. 

no of rows in single table

hi friends...i need one count...one sql table how many rows able to create or write in sql server 2005

how do i develop a cascade drop down lists which get the chart names from excel sheets

hi i have to develop a cascade dropdownlist. one of the drop down is used to retrive only excel docs from a specific doc library and and the other drop down to get all the chart names and attach it to the second dropdown list in doc lib item changed event thanks    

Cascading drop box holds old value if empty on auto post back

I have 3 drop boxes: 1.) Choose Operation 2.) Choose Site 3.) Choose Area. All three of them are linked to an SQL server database which has 3 tables following the same heiarchy of order. I.e. Areas belong to a Site and Sites belong to an operation. And there can only be one operation per site, or one site per area. First you select an operation, then the page auto postbacks to filter the sites. Then you pick a site and again it autopostbacks to filter the areas. The issue I am having is that when an associated operation has no sites underneight it, and therefore no areas under that, the previous values that were in the boxes are displayed and the user can't click on the boxes anymore. I think this is kind of cheap looking and would like a way to make it so the boxes are clear (i.e. nothin in them). Is there anyway to check if they are going to freeze like that and assign them blank values??Any suggestions on this issue would be greatly appreciated!-Jordan

Tricky SELECT query from a Single Table

Hi I have a 2 rows of data in a table as mentioned below   Table1             ElementID Month Year Planned Cost UnplannedCost PlannedExpense UnPlannedExpense 4 9 2010 NULL 40 NULL 20 4 9 2010 400 NULL 200 NULL  I need a SELECT query to get the output in a single row as ElementID Month Year Planned Cost UnplannedCost PlannedExpense UnPlannedExpense 4 9 2010 400 40 200 20 Could anybody help me in writing a query for this? Thanks

Autopostback on the last list in a Cascading drop down list series

Hi,First off I'm very new to Ajax for .NET.  I have a Cascading drop down list that is working fine to load the correct lists however I would like to have the last one initiate a query and display a datagrid on the same page containing the results of the query.  Without Ajax involved this seems rather easy by using autopostback on the drop downs.  If I could do it through Ajax that would be great but I can settle with having the page to reload to display the data.  Right now I'm not sure how to do either.  I enabled autopostback on the last drop down and wrote a method for it but I get an error at runtime saying:Invalid postback or callback argument So I'm really not sure what to do to get this to work right.Any help would be appreciated.Thanks,-Jordan

Excel Drop Table question

Can anyone tell me if the drop table syntax should delete only the data in a worksheet or clear the formatting as well. If not is there a way to clear all the formatting. Thanks

help with drop down lists

Hello i have 4 ddl for factory, category, model and engine im tryin to make connection between them so i could select factory and then the other ddls will change the data that relative to the select item on factory. I know how to make connection between them but i need to use AppendDataBoundItems so the user could select "all models" or "All categories" without success!!! when i select factory the category get the models and when i select different factory the new model join the other factory models and so on and on. i was try with ajax cascading ddl but i didnt success cause the user need to have the change to select factory and engine (for example) but the engine is enabled = false until the user select 3th ddl PLEASE HELP

To Search a word in all the columns of a Single Table

Dear Friends, How can I search a word in all the columns of a table?Please advise.

How to Listen to MSMQ and Database table from a single WCF service

Hi, I have one WCF service which is listenibg to MSMQ. Once message is added to MSMQ, it will start processing the business logic. But my requirement is to make this WCF service to listen to one database table also. If any message is logged to this table or any message added to MSMQ, the WCF service should start processing the business logic. Could you please let me know if it's feasible using WCF service. It would be great if you can tell me the alternate approaches to implement this functionality. Ram.  .NET related discussions

Adding content to 3 sharepoint lists in a single form/workflow


Hi Folks,

I know there has to be a better way of doing this.

I am setting up a staff training intranet site. the main objectives is to keep a history of what training has been undertaken by company employees.

the solution I have at the moment is

1) create a SharePoint list item on a list called training provider ( for the provider of the training course )

2) create a SharePoint list item on a list called training ( one of the columns is a lookup on the training provider list )


3) create a list item on a list called training schedule which links the employee and the training course.

Going forward I would like the employees themselves to be able to enter the details of the training courses themselves.

I'm concerned that the above process is unwieldly/cumbersome.

Is infopath the way to go ? would a solution involving workflow be better ?



Creating a generic template writer that can handle drop downs and option lists


If I have a the following model

public class User
		public List<Company> Companies;
		public string Login { get; set; }

		[DisplayName("First Name")]
		public string FirstName { get; set; }

		[DisplayName("Last Name")]
		public string LastName { get; set; }

		public string Password { get; set; }

		private int Company { get; set; }

And the following generic control template writer (which would have to be extended appropriately)

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<% foreach (var prop in ViewData.ModelMetadata.Properties .Where(pm => pm.ShowForEdit && !ViewData.TemplateInfo.Visited(pm))) 
{ %>
	<div class="SD_FieldItem">
		<% if (!String.IsNullOrEmpty(Html.Label(prop.PropertyName).ToHtmlString()))
			switch (prop.ModelType.Name)
				case "Boolean":

						<div class="SD_BoolField">
							<%= Html.CheckBox(prop.PropertyName) %>
							<%= Html.Label(prop.PropertyName) %>
							<%= Html.ValidationMessage(prop.PropertyName, 

Performance Drop when switching from a #temp table to a @temp table variable


I am trying to convert a stored procedure to a table valued function and the performance has taken a HUGE hit and I was wondering if there was anything that can be done about it. Since a table valued function can not use #temp tables it must be converted to a @temp table variable.

Here are some steps I have already taken...

The original stored proc starts off by populating a #temp table via "Select x Into #temp ..."

Leaving it a stored proc for now, I explicitly created the #temp table and did an "Insert Into ... Select From" to more closely model how it must work when using a @temp table variable. There was no discernible performance difference.

Still leaving it as a stored proc, I then swapped out the #temp table with the @temp table variable and now, all of the sudden, the performance drops from sub-second to over a minute!!!

The temp table only has one field defined as an int and it is distinct, so I tried making the field the Primary Key to see if that would help and it did not.

The temp table is created by scanning a table with around 11,000 rows and the temp table itself has about 4400 rows in it (if it makes a difference to anyone).

Does anyone have any suggestions (or hope) for me?


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