objectdatasource

GridView sorting doesn't work when I Enable Caching in Custome Paging and sorting

依然范特西╮ 提交于 2019-12-24 04:55:09
问题 I have a GridView that use a stored procedure for custom paging and sorting . It's OK and works fine (Both paging and sorting) , But the problem is when i Enable Caching in ObjectDataSource like : EnableCaching="True" It properly cache every page that the user visit , But at this case when the user want to sort it raise an error(While that works fine if EnableCaching ="False" : The data source 'ObjectDataSource1' does not support sorting with IEnumerable data. Automatic sorting is only

ObjectDataSource not calling Insert method when it has extra parameters

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 20:16:05
问题 I'm new to ASP.NET, and I'm trying to implement a custom ObjectDataSource Insert method. The default business method works fine (with a single object parameter). However when I add an extra parameter, the business method does not get called. Here is my code - Insert() always gets called, but InsertWithParams() never does. // Business Layer public class MyObject { public MyObject() {} public string Foo { get; set;} } namespace MyLogic { public static Insert(MyObject m) { // ... do DB insert }

ObjectDataSource Paging -> no data displayed in GridView

强颜欢笑 提交于 2019-12-23 17:35:03
问题 i have an objectdatasource and a gridview configured as shown below (using VS2008 w/ .NET3.5): <asp:ObjectDataSource ID="odsMainData" runat="server" EnablePaging="True" OldValuesParameterFormatString="original_{0}" SelectMethod="GetMainData" TypeName="ErrorViewer.Model.ErrorViewModel" SelectCountMethod="CountMainData"> <SelectParameters> <asp:Parameter Name="maximumRows" Type="Int32" /> <asp:Parameter Name="startRowIndex" Type="Int32" /> </SelectParameters> </asp:ObjectDataSource> <asp

ASP.NET 2.0: Specifying an instance of an object for an ObjectDataSource

时光怂恿深爱的人放手 提交于 2019-12-22 11:17:59
问题 I'm using an ObjectDataSource to bind data to a GridView; it works fine except that it always creates a new object to use as a data source. I can do all the setup just fine but I cannot use an instance of an existing object to specify as the "data source" for it. Is it possible to do this? If so, how? If it's not possible, why? EDIT: Here's the gist of what's going on (object types changed): On the first page you are editting the attributes for a dog. One of the attributes is "has puppies"

GridView's UpdateMethod not firing

怎甘沉沦 提交于 2019-12-20 05:38:51
问题 I've got a GridView that I bind to a ObjectDataSource programmatically, like: ObjectDataSource risks = new ObjectDataSource("Risks", "RetrieveProjectRisk"); risks.TypeName = "Promanto.ProjectRisks"; risks.DataObjectTypeName = "Promanto.ProjectRisk"; risks.SelectMethod = "RetrieveProjectRisk"; risks.DeleteMethod = "DeleteProjectRisk"; risks.InsertMethod = "AddProjectRisk"; risks.UpdateMethod = "UpdateProjectRisk"; risks.SelectParameters.Add("WhereClause", TypeCode.String, "ProjectID ='PR0002'"

Using generic classes with ObjectDataSource

筅森魡賤 提交于 2019-12-18 15:55:42
问题 I have a generic Repository<T> class I want to use with an ObjectDataSource. Repository<T> lives in a separate project called DataAccess. According to this post from the MS newsgroups (relevant part copied below): Internally, the ObjectDataSource is calling Type.GetType(string) to get the type, so we need to follow the guideline documented in Type.GetType on how to get type using generics. You can refer to MSDN Library on Type.GetType: http://msdn2.microsoft.com/en-us/library/w3f99sx1.aspx

GridView not Rebinding Properly After Postback

二次信任 提交于 2019-12-18 04:14:21
问题 I have a GridView that has a DataSourceID pointing to an ObjectDataSource. The ObjectDataSource points to a method that returns a LINQ IQueryable by using the TypeName, SelectMethod, and SelectCountMethod properties of the ObjectDataSource control. What happens is that the data loads properly upfront. However, on postback, if I remove the rows from the GridView and try to rebind using the explicit GridView.DataBind(), it doesn't work. I know LINQ is returning the proper rowcount and such

Paging & Sorting grids with ASP.Net MVC

僤鯓⒐⒋嵵緔 提交于 2019-12-17 07:03:09
问题 Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. I'm new to MVC, and am not following how you'd do paging and sorting on a grid. I'm used to using the asp.Net GridView control with an ObjectDataSource pointed at objects in our business layer - and in that case the ODS handles all of the paging & sorting using the methods that our ORM generates on

Paging & Sorting grids with ASP.Net MVC

那年仲夏 提交于 2019-12-17 07:03:00
问题 Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. I'm new to MVC, and am not following how you'd do paging and sorting on a grid. I'm used to using the asp.Net GridView control with an ObjectDataSource pointed at objects in our business layer - and in that case the ODS handles all of the paging & sorting using the methods that our ORM generates on

selectcountmethod in objectdatasource isn't called

妖精的绣舞 提交于 2019-12-13 18:08:32
问题 I am facing a situation where the selectcountmethod isn't called. The getdatamethod is called every time, but the count method is not. I also tried to remove the selectcountmethod and set enablepaging="false" and no data is displayed either, even if the dataset is not empty. <asp:GridView ID="gvGradeDocent" runat="server" AutoGenerateColumns="False" AllowPaging="True" DataSourceID="odsGradeDocent" DataKeyNames="Id" PagerStyle-HorizontalAlign="Right" PagerSettings-Position="Top" CssClass=