I thought you need client-side implementation? C# is a server-side code. If you want to use C# then you need use DropDownList SelectedIndexChanged event to populate the other dropdownlist based from the selected value of the first dropdownlist. Just make sure to set AutoPostback to True to trigger the event.
Kindly describe your full and proper question, and besides this all the links that is mentioned in this forum are related to cascading dropdown list only , you just check out once and even if you get some problem than just drop the question here, Trust me these links are really helpful just go through once.
Source Code:
Code Behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
using System.Web.Services.Protocols;
namespace Mystuff.Ajax
{
public partial class Cascadingdd : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public CascadingDropDownNameValue[] GetVendors(string knownCategoryValues,
string category)
{
List l = new List();
l.Add(new CascadingDropDownNameValue("International", "1"));
l.Add(new CascadingDropDownNameValue("Electronic Bike Repairs & Supplies", "2"));
l.Add(new CascadingDropDownNameValue("Premier Sport, Inc.", "3"));
return l.ToArray();
}
}
}
Am getting error Like "Method Error "
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 10, 2015, 4:07 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 10, 2015, 4:50 AM EDT
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted Jun 10, 2015, 6:24 AM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 10, 2015, 7:58 PM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 10, 2015, 8:00 PM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 10, 2015, 8:35 PM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 10, 2015, 8:41 PM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 10, 2015, 8:44 PM EDT
Nilesh JadavRank #109 · 20.3K reputationPosted Jun 10, 2015, 8:56 PM EDT
http://www.c-sharpcorner.com/UploadFile/009464/cascading-one-dropdownlist-with-other-dropdownlist-in-asp-ne/
SreenishRank #7,298 · 244 reputationPosted Jun 10, 2015, 9:09 PM EDT
Nilesh JadavRank #109 · 20.3K reputationPosted Jun 10, 2015, 9:48 PM EDT
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted Jun 11, 2015, 3:36 AM EDT
Here's a quick example of cascading dropdownlist using Client-Side JavaScript and without database:
JAVASCRIPT:
HTML:
SreenishRank #7,298 · 244 reputationPosted Jun 11, 2015, 4:10 AM EDT
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted Jun 11, 2015, 4:35 AM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 11, 2015, 7:44 PM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 11, 2015, 8:15 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 11, 2015, 8:15 PM EDT
Nilesh JadavRank #109 · 20.3K reputationPosted Jun 11, 2015, 9:06 PM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 11, 2015, 9:11 PM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 11, 2015, 9:12 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 11, 2015, 9:14 PM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 11, 2015, 9:15 PM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 11, 2015, 9:16 PM EDT
Nilesh JadavRank #109 · 20.3K reputationPosted Jun 11, 2015, 9:17 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 11, 2015, 9:22 PM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 11, 2015, 9:26 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 11, 2015, 9:33 PM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 11, 2015, 9:39 PM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 11, 2015, 9:42 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 11, 2015, 9:43 PM EDT
SreenishRank #7,298 · 244 reputationPosted Jun 11, 2015, 9:44 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts