I successfully bind ListView DataSourceID to ObjectDataSource but it binds only initially on Page_Load event. When I want to bind another data through a Button_Click event, the new data doesn't bind.
aspx code:
[Code]....
Codebehind:
[Code]....
On Page_Load, I get result:
A1 <hr /> T1 A2 <hr /> T2 A3 <hr /> T3
When I Button1_Click, nothing happens, no error, no any more results and _airLineData is 53 records, not 3 records (A1T1 to A3T3) I want the binding to be with DataSourceID to ObjectDataSource (not through DataSource property and control.DataBind() method)
I receive the error (Both DataSource and DataSourceID are defined on 'DataList1'. Remove one definition) in the following code. Could anyone help me sort this out. I do not have anything named DatasourceID that I can find. [code]...
I'm facing a wierd problem with GridView and ObjectDataSource. I bind GridView to my business objects via ObjectDataSource. Everything was working fine until I decided to add a new field in my buisness object and wanted to add a column to GridView to show it. Somehow that column is NOT shown in the GridView's list of available columns. I have tried refreshing schema, rebinding, etc. I'm using GridView inside a user control which is used as a web part. Does that make a difference ?
I'm working on two gridviews , each one binded to an sqldatasource object,when I want to modify the 2nd gridview (DataSource=DataTable) an error fired !Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.
I have a grid that receives products over a GetList methods via ObjectDataSource. The Product class contains also a Object Supplier. If I change in the drop down list of the grid the supplier for a product and I click update the ID of the suppliier is still the same. I have debugged the call of the update method and checked the parameter in the product object. I wrote the following code in the SelectedIndexChanged event and the text box shows the right id but not the update method.
Can you post of an example of Gridview with EditItemTemplate using ObjectDataSource as data connectionand Update the the specific row. Ihave lots of sleepness night with this problem.
I've been working a gridview that uses an ObjectDataSource to perform either select, insert, delete or update. I was able to get everything to work correctly with the GridView except when it came to performing an update. My first issue that I came across was that it was tacking on two extra columns or fields that I didn't really expect. The function being called (SavePipelineUser) only expected 4 parameters and was getting 6 in total. This was occuring even though I had placed OldValuesParameterFormatString="original_{0}" or OldValuesParameterFormatString="{0}" within the GridView's attributes.
Ok, So I was able to resolve this issue by going into the OnUpdating event in the ObjectDataSource and doing the following below. This effectively removes the additional parameters from being added. However, I now have a new problem. There doesn't appear to be any values actually being passed into this method. So, while no errors appear, nothing gets updated. Can anyone explain to me why my values are not being carried forward? I've spent about a day and a half working on this issue and was able to get around this by just going with the GridView's RowUpdating event and grabbing values from grid to manually get it to update. While I'm very happy for anything to be working after so much time, I still feel like this is a bad hack for this to work. I have a hard time fathoming why this seemingly simple use of the GridView on my part has turned out to be very complicated. I'm extremely leary now of using the ObjectDataSource object for anything if it's going to be this much of an effort.
I'm using a GridView with an ObejctDataSource. The data is provided by a business object and not a DB. It returns a list of people and each person belongs to a group. Now I need to filter data. For example, I need to return list of people in specific groups. How can I specify a list of groups to be able to filter the data ? Could I use SQL like syntax ? I understand the filter expression works only when data is returned as a datatable. But in my business object I maintain data as hashtables and return as List<PeopleInfo>. Do I need to return list as datatable instead ?
I have a gridview with the ObjectDataSource and the Update does not work. When I click on Edit, I go to Edit mode but Update will not work at all. No errors. I do believe that it is in the RowUpdating method but cannot figure out how to call the method UpdateBook from the BookManager BAL.
BAL BookManager
[Code]....
Gridview
[Code]....
RowUpdating
[Code]....
Put in Breakpoints and it is getting to the RowUpdating but will not update.
I get the following error when trying to delete a row in a gridview. The error is strange, since I dont pass 2 parameters as far as I can see.This is the error and the code is below:
Server Error in '/' Application.
ObjectDataSource 'odsRooms' could not find a non-generic method 'DeleteRoom' that has parameters: id, locationid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: ObjectDataSource 'odsRooms' could not find a non-generic method 'DeleteRoom' that has parameters: id, locationid.
Source Error: [Code]....
Stack Trace: [Code]....
[InvalidOperationException: ObjectDataSource 'odsRooms' could not find a non-generic method 'DeleteRoom' that has parameters: id, locationid.] System.Web.UI.WebControls.ObjectDataSourceView.GetResolvedMethodData(Type type, String methodName, IDictionary allParameters,[code]....
I have a gridview being data bound by an objectdatasource which points to a BLL/DAL. I have paging and sorting enabled within the gridview. I have the fields configured in the look/fell I want from a templatefield. This templatefield has the sort expression (date) I want things to be sorted by. All this works as it should and I have no issues with it.But, the issue is that when I click on the header to sort asc/desc by date, I have to click on it twice for it switch to descending order. E.g. I hit the webpage and it lists all the information in the gridview, sorted by date, ascending order. If I want to sort by descending order, I have to click the date header twice in order for the gridview to sort the information in descending order; the clicks cause a post-back and the whole screen is refreshed.
I am having some difficulty enabling sorting on a gridview that has data in it that has come from an objectdatasource.
The AllowSorting="True" function doesnt work for ObjectDataSource so I need to find a work around...I am guessing that I will need to do something in code in order to get this off the ground.
I have an ObjectDataSource giving me data similar to: OrderNumber OrderDate OrderValue OrderItems The first three are simple data types and the last has multiple occurrences of another class: OrderLineNumber OrderItem OrderQuantity The ObjectDataSource will only contain one row (which might make things simpler). So, there will be one OrderNumber, OrderDate and OrderValue; and then several occurrences of OrderItems (each containing OrderLineNumber, OrderItem and OrderQuantity).
I am displaying OrderNumber, OrderDate and OrderValue in the FormView - that work's fine, as expected. I have placed a GridView within the FormView and am failing miserably to get it to bind to OrderItems. I have tried the obvious things like specifying "odsWhatever.OrderItems" as the DataSourceID for the GridView, but to no avail.
I am using ObjectDataSource controll to bind gridview and using custom paging. Everything working fine but the problem arises when last page contains only one record and i try to delete it-- gridview disappear.
Below is ObjectDataSource declaration..It is working fine..only problem is with deleting from last
i have been following the asp.net data access tutorials on this site. When i try to update, nothing happens. I believe the problem lies with my wrong coding on the BLL part. I'm using table adapters. Could anyone point out what iswrong with my code or tell my what the correct code is?
VS2010 Ultimate ASP.NET 4.0 Web Appliction project
I have a simple aspx page with a GridView Bound to an ObjectDataSource utilizing a class object that returns a DataView.
There are no errors generated, but the GridView does not display any rows. If I check the return value of the ObjectDataSource in the Selected event in the Immediate window (?CType(e.ReturnValue,DataView).Count), there are 51 rows. However, (?Me.GridView1.Rows.Count) shows 0 rows. The exact same page in VS2008, ASP.NET 3.5 works fine. how to get the GridView to display the rows? What has been done to the GridView in 4.0?
Page and code below -
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm2.aspx.vb" Inherits=".WebForm2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
I'm using a sqldatasource to populate a gridview. I've figured out how to use the dynamic sorting, but I'm curious if there is a way to add filtering on each column. So, if a user wants to pick one specific value from grid, then it would re-populate with only rows that have the specific value selected. Excel has this feature in a workbook, but am curious if this is possible on a vb.net web page.
I'm trying to bind both GridView and DetailsView to a single ObjectDataSource declaratively (in markup). I'm getting the error read as below when I tried to run it.
"The DataSourceID of 'DetailsView1' must be the ID of a control of type IDataSource. A control with ID 'ReservationsDataSource' could not be found."
It works when I bind GridView and DetailsView each seperately to my ObjectDataSource. Is it I can't bind two pagable data web controls to a single datasource?? or there is a trick needed to be done for this to work.
FYI, I'm trying to create a Master/DetailsView of my data. DetailsView of my application should show the record selected in GridView and it should be editable.
I have an object data source control. and to insert the control I add the object to the database then call databing on the gridview the DataSource control is bound to.
My question is - how would I know where the newly added row is? I can'y go by id, because the dbase creates the id.
I'm thinking maybe last data key, but based on the sort that would be accurate.
I am trying to hook up custom pagination with an ObjectDataSource to my GridView. However, this thing renders no data, but does render the column headers. The debugger clearly indicates a populated DataTable being returned.