Why does CascadingDropDown require webmethods?

I'm just coming up to speed on the AJAX Toolkit, and would really like to use the CascadingDropDown controls (www.asp.net/ajaxlibrary/act_CascadingDropdown.ashx) in conjuncture with a SQL Server database.

The thing is, the examples I keep finding always reference webmethods. Perhaps I bypassed the "why webmethods are used in general w/ AJAX" notes while coming up to speed, but it seems like the reliance on webmethods came out of the blue without any context.

Can any explain why the CascadingDropDown control relies on webmethods, and if this is something that the CascadingDropDown specifically requires, or if it's a more general AJAX toolkit reliance?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Manoj PatilSr. Software EngineerCommented:
This may Help you


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cdakzAuthor Commented:
Upon further review, I'm thinking that the webmethod is required due to the client-side-ness of the AJAX control. In other words, the 2nd/child CascadingDropDown can't, be definition, get data via a traditional server-side method (where my head's at) without performing a full postback (thereby defeating the whole client-side/ascyn-ness of AJAX).

Btw, I looked at :techChallenger1's link to the whitepaper about accessing SQL Server, and it definitely helps (better-explained , simple example than others I've found).

However, it begs a different question: The data-access examples for the CascadingDropDown use 'old-fashioned" SQL Connections and datareaders instead of LINQ. Is there any reason they CAN'T use LINQ?

If LINQ is useable the CascadingDropDown , can anybody point to an example?
Manoj PatilSr. Software EngineerCommented:
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

cdakzAuthor Commented:
That example uses LINQ, but it's for the wrong control. It's for the standard DropDownList control instead of the AJAX CascadingDropDown control.
cdakzAuthor Commented:
Much closer! I'm using VB.NET on this project, and after converting the example from C# to VB, I'm getting the following error. I'm not sure if it's because it's one of those specific things supported by C# instead of VB, if the conversion from C# to VB went slightly amiss, or something else.

Any insight?
Here's the offending line:
Return vals.ToArray(Of CascadingDropDownNameValue)()

Open in new window

Here's the error:
Extension method 'Public Function ToArray() As TSource()' defined in 'System.Linq.Enumerable' is not generic (or has no free type parameters) and so cannot have type arguments.

Open in new window

Here's the code snippet that contains the code snippet (for better context):
  <WebMethod()> _
  Public Function GetManufacturers(knownCategoryValues As String, category As String) As CascadingDropDownNameValue()
    Dim db As New DataClassesDataContext
    Dim vals As IEnumerable(Of CascadingDropDownNameValue) = Nothing
    Dim targetID As Short = 0
    vals = From tp In db.Manufacturers _
     Select New CascadingDropDownNameValue()
    Return vals.ToArray(Of CascadingDropDownNameValue)()
  End Function

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.