objectdatasource

GridView with ObjectDatasource UpdateMethod

佐手、 提交于 2019-12-10 09:39:57
问题 I have an ASP.NET WebForms page containing an ASPxGridView and an ObjectDataSource : <dx:ASPxGridView ID="gvEmployees" runat="server" AutoGenerateColumns="False" DataSourceID="objDsEmployees" KeyFieldName="EmployeeId"> <Columns> <dx:GridViewCommandColumn VisibleIndex="0"> <EditButton Visible="True" /> </dx:GridViewCommandColumn> <dx:GridViewDataTextColumn FieldName="EmployeeId" VisibleIndex="1" /> <dx:GridViewDataTextColumn FieldName="Name" VisibleIndex="2" /> <dx:GridViewDataTextColumn

How to get row count of ObjectDataSource

与世无争的帅哥 提交于 2019-12-10 02:17:30
问题 Hello you all How can i get row count of ObjectDataSouce ? I use ObjectDataSource and DataList . I want show some thing to the user for example in a label when there are certain row returned by ObjectDataSource . One of situation is when there is no record . Thank you . 回答1: I was looking for the same answer... Another solution I ended up using is the following: This is found on a .vb file behind an .aspx page. It handles the "selected" event of the datasource. Protected Sub ObjectDataSource1

DevExpress AspxGridView filter in ObjectDataSource

微笑、不失礼 提交于 2019-12-08 09:14:29
问题 Yet another problem with DevExpress AspxGridView :) The context: One Page In the Page, a custom control In the custom Control, a AspxDropDown The AspxDropDown has a DropDownWindowTemplate In the DropDownItemTemplate , I add a GridView and a paging/sorting/filtering enabled ObjectDataSource When handling the selecting event of the ObjectDataSource , I should set filter parameters for the datasource. There filter parameters should come from the FilterRow of the AspxGridView (preferably using

System.FormatException: String was not recognized as a valid DateTime

萝らか妹 提交于 2019-12-08 06:38:22
问题 I am using c#.net. Thanks in advance for any help. I am using a Repeater and a ObjectDataSource. I use LINQ to connect to the database. This requires a parameter to be passed through (used within the WHERE clause) public IQueryable<comments> GetComments(DateTime todaysDate) { return (from c in dc.comments where displayDate.Date == todayDate.Date select c); } I am encounting the error above and don't know why. Here is where the problem lies: <asp:Parameter DefaultValue="<%=Convert.ToDateTime

I assume SqlParameter.IsNullable only makes sense when…?

你离开我真会死。 提交于 2019-12-08 00:21:38
问题 1) When SqlParameter.IsNullable is set to true , received null value is converted to DBNull.Value and sent to database. Thus I would assume setting IsNullable to true only makes sense when GridView’s Parameter.ConvertEmptyStringToNull is also set to true ? 2) Both GridView’s and ObjectDataSource’s parameters have a ConvertEmptyStringToNull property. But is there ever a situation where ( when trying to update data source ): • where we should set GridView’s Parameter.ConvertEmptyStringToNull to

asp.net how can ObjectDataSource access System.Web.UI.Page objects

这一生的挚爱 提交于 2019-12-07 16:12:26
问题 I use ObjectDataSource as below. <asp:ObjectDataSource ID="Item" runat="server" SelectMethod="Grid_DataBind" TypeName="XXX.XXX.XXX" DataObjectTypeName="Controller.Items" UpdateMethod="UpdateRow_Grid" InsertMethod="InsertRow_Grid"> When InsertMethod fire, everything work fine but ... public IList<Items> InsertRow_Grid(Items item) { item.ID = System.Guid.NewGuid().ToString(); bool contains = GridSource.AsEnumerable() .Any(row => item.JobID == row.JobID); if (!contains) { GridSource.Add(item); }

Objectdatasource and Gridview : Sorting, paging, filtering

依然范特西╮ 提交于 2019-12-07 08:39:02
问题 Im using entity framework 1.0 and trying to feed out a Gridview with a objectdatasource that have access to my facade. The problem is, that it seems to be particulary difficult and haven't seen anything that realy do what i want it to do on the internet. For those who know, a gridview feeded with an objectdatasource, it can't sort automaticaly then you must do it manually. It's not that bad. Where it becomes a nightmare, its when we add paging and filter settings to a gridview's datasource.

Using ObjectDataSource and DataObjectTypeName, How Do You Handle Delete Methods With Just An Id Parameter?

廉价感情. 提交于 2019-12-07 07:14:49
问题 If I have an ObjectDataSource setup like: <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Employee" InsertMethod="Insert" UpdateMethod="Update" DeleteMethod="Select" TypeName="EmployeeDB"> </asp:ObjectDataSource> and a data/business object with methods like: public class EmployeeDB { public void Insert(Employee emp) public int Update(Employee emp) public bool Delete(int id) } How do I get the objectdatasource to use the Delete method with the parameter that is

I assume SqlParameter.IsNullable only makes sense when…?

前提是你 提交于 2019-12-06 13:23:27
1) When SqlParameter.IsNullable is set to true , received null value is converted to DBNull.Value and sent to database. Thus I would assume setting IsNullable to true only makes sense when GridView’s Parameter.ConvertEmptyStringToNull is also set to true ? 2) Both GridView’s and ObjectDataSource’s parameters have a ConvertEmptyStringToNull property. But is there ever a situation where ( when trying to update data source ): • where we should set GridView’s Parameter.ConvertEmptyStringToNull to true , but then set ObjectDataSource’s Parameter.ConvertEmptyStringToNull to false ?! • or where we

GridView with ObjectDatasource UpdateMethod

半腔热情 提交于 2019-12-05 22:20:53
I have an ASP.NET WebForms page containing an ASPxGridView and an ObjectDataSource : <dx:ASPxGridView ID="gvEmployees" runat="server" AutoGenerateColumns="False" DataSourceID="objDsEmployees" KeyFieldName="EmployeeId"> <Columns> <dx:GridViewCommandColumn VisibleIndex="0"> <EditButton Visible="True" /> </dx:GridViewCommandColumn> <dx:GridViewDataTextColumn FieldName="EmployeeId" VisibleIndex="1" /> <dx:GridViewDataTextColumn FieldName="Name" VisibleIndex="2" /> <dx:GridViewDataTextColumn FieldName="Email" VisibleIndex="3" /> <dx:GridViewDataTextColumn FieldName="Telephone" VisibleIndex="5" /> <