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?
cdakzAsked:
Who is Participating?
 
Manoj PatilSr. Software EngineerCommented:
This may Help you

CascadingDropDown
0
 
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?
0
 
Manoj PatilSr. Software EngineerCommented:
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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.
0
 
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

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.