Я сделал следующее:
Ни один из моих элементов управления ObjectDataSource в bal.cs не виден, может видеть этот класс.что делать ??????????? !!!!
using System; using System.Collections.Generic; using System.Linq; using Data; public class BAL { public List<String> GetCountries() { using (var context = new NORTHWINDDataContext()) { return (from c in context.customers select c.country).Tolist(); } } public List<customer> GetCustomersByCountry(string country) { using (var context = new NORTHWINDDataContext()) { return (from c in context.customers where c.country == country select c).Tolist(); } } public customer GetCustomer(string custID) { using (var context = new NORTHWINDDataContext()) { return (from c in context.customers where c.CustomerID == custID select c).singleOrDefalt(); } } }
Попробуйте просмотреть свойства вашего класса в папке App_Code.
Если для файла «Build Action» установлено значение «content», то, похоже, это происходит.Как только вы измените класс на «compile», он начнет отображаться в списке ObjectDataSource
Настройка ObjectDataSource вручную:
ObjectDataSource
<asp:ObjectDataSource id="someid" runat="server" TypeName="BAL" SelectMethod="GetCountries"> </asp:ObjectDataSource>