DataSource Controls :: Handle Coding A Proper DeleteMethod To Assign To ObjectDataSource

Jan 24, 2010

I currently have a gridview which I have populated using the following method:

[Code]....

What I am looking for is advice on how to handle coding a proper DeleteMethod to assign to my ObjectDataSource (via my class file). I have been searching through several forums, websites and other media and have been left a little confused. Everyone seems to have their own method, none of which I have been able to successfully adapt to my own needs. Here is some of the functionality that I am looking for:

1.) Delete item using Gridview's delete button

2.) Delete the record from both the datatable (and Gridview Row) and the database that the table was generated from.

3.) Upon deletion, refresh gridview

This may sound simple to many of you, but I need a little advice as to where to start. Any applicable threads, tutorials etc.

View 3 Replies


Similar Messages:

C# - Proper Way To Handle Several Automatic Redirects?

Dec 14, 2010

I have a website that basically allows customers to build a cart with an item that can be configured. A user will pick an item, and they'll be prompted to pick the first option they want, they get sent to the second step where they pick their second option, etc. The number of steps and the number of options are variable, as they are defined by the client. Usually the item only has 2-3 steps with 5-10 options. However, in order to make it faster for the customer, if there is only one option available for the given step, it will automatically be chosen and the user will be sent to the next step.

A client decided to set up an item with 10+ steps with only one option for each step. This results in the entire process automatically choosing everything. FireFox doesn't like this, as it gives the error Firefox has detected that the server is redirecting the request for this address in a way that will never complete. I haven't checked IE or Chrome, although it probably gives similar errors).

What's the best way to fix this? Right now the process is basically User picks item user picks option if there is more than one option available. Otherwise the website does step 3 itself. POST to add the option to the cart Redirect to Page.aspx?step=# repeat step 2-4 as many times as necessary

Is there any change I can make to the code or page so that FireFox doesn't think I'm in an endless loop?

View 2 Replies

Forms Data Controls :: Handle Sorting And Paging When Objectdatasource Is Being Built Dynamically?

Sep 7, 2010

i am building my objectdatasource dynmically when certain buttons are clicked on the page.. and with that the gridview is being displayed with the results of the objectdatasource that was built.

So my gridview code looks like this:

[Code]....

How can i enable sorting and paging if the datasource is being built on button click event?

View 16 Replies

DataSource Controls :: Replace Storeprocedure With C# Coding?

Mar 10, 2010

My database is not allowing me to execute store procedure as perssion is denied by administrator. But I have to run a store procedure in my application, described below.

Can I replace this store procedure with "select query " on .net coding page i.e I want to make a function which will only select data from database and give the result same as this store procedure . store procedure-

CREATE procedure NEW_VIV
@user varchar(50),
@year char(50),
@month char(50)

[Code]....

View 3 Replies

DataSource Controls :: Queries Not Returning Proper Data?

Mar 17, 2010

I am having trouble with queries because they are not returning the data needed, and I am having trouble figuring out why because I only am testing with 2 records.First I want a query to return all records for one customer as follows:

[Code]....

There are two records with the customerID of 1, but it only returns one,next I try to return only one record, the AccountPrimary or customer_contacts.IsPrimary, but when I add " AND customer_contacts.IsPrimary = 'True' "at the end of my query it then returns both records, but only one IsPrimary = True and the Other = False. Is it backwards? I also tried another method and it returned 30 of the same record and I only have 2

View 4 Replies

DataSource Controls :: ObjectDatasource And Class As Datasource

Jun 24, 2010

I am really having a hard time trying to write something from scratch I created a 'Person' Class.Public Class Person

Private _FirstName As String = ""
Private _LastName As String = ""
Private _Age As Integer = 0
Public Sub New(ByVal FirstName As String, ByVal LastName As String, ByVal Age As Integer)
FirstName = FirstName
_LastName = LastName
_Age = Age
[code]...

View 1 Replies

DataSource Controls :: Objectdatasource Does Not Run?

Jan 26, 2010

I have set the objectdatasource in the web form. Does I need to check anything as I find that method "objProductSuppliment_Inserted" does not run??

-----------------------------------------------------------------------------------------------------------

<asp:ObjectDataSource ID="objProductSuppliment" runat="server"
OnInserted="objProductSuppliment_Inserted"
TypeName="BLL.WMS.ProductSuppliment"

[code]...

View 6 Replies

DataSource Controls :: Objectdatasource Does Not Bind The Name And ID?

Jan 16, 2011

I've created a query in the table adapter for retrieving customer name based on the first letter. The query is executed fine, and the output is the customer name and ID. A Customer BLL accesses this query, and sends the results to an objectdatasource. This control is configured to use this customer-by-letter query. However for some reason, this objectdatasource does not bind the name and ID, but instead all the other fields produced by the main query in the table adapter (i.e. name, address, phone, etc....).

I'm probably not configuring something correctly, but I'm not sure what.

The BLL code:

[Code]....

The .net code:

[Code]....

View 4 Replies

DataSource Controls :: BLL Add Method & ObjectDataSource?

Jan 4, 2011

My Business Logic Layer has AddItem method that add's to Items table in db along with an entry in Balance table.AddItem method uses two TableAdapters Items & Balance. Both these have corresponding Business Objects as Item and Balance.

Here is the AddItem method :

[Code]....

ASPX Page with DetailsView & ObjectDataSource

[Code]....

Now executing this page generates error as

ObjectDataSource 'ObjectDataSource2' could not find a non-generic method 'AddItem' that has parameters: _item, _balance, ItemName, GroupId, CategoryId, AuId, Rate, TotalStrScale, OffsStrScale, OffsAE [code]...

View 1 Replies

DataSource Controls :: ObjectDataSource With BLL Methods?

Jun 22, 2010

I'm creating an ASP.net website with 3 layers (Presentation, BLL and DAL).

BLL and DAL are 'class library'. DAL has a typed dataset. Presentation refers BLL and BLL refers DAL.

I wanna populate my GridViews with ObjectDataSource, but it only shows me the DAL. Nothing from BLL...

What am I doing wrong?

View 2 Replies

DataSource Controls :: Complex ObjectDataSource And ASP?

Apr 17, 2010

Consider a fairly complex business object. For the sake of discussion, let's think about a "ClassRoom" object - that will have some attributes which occur once, such as "capacity" and "area". It will also have some repeating attributes - perhaps "desks" which will itself be a collection of desk objects. The desk object will in turn have attributes such as "width" and "height".My example is more complex, but that should show where I am coming from. The business object, as you would expect, exposes methods to get the attributes in and out. There is also logic included to perform the underlying database updates. Of course, the necessary business validation is also in there.

In terms of binding to the ASP page, I will need to bind the attributes of "ClassRoom" to a set of fields on the page (using one method on the object). I will also want to bind the desks collection to a Repeater or GridView (using another method on the object).Presumably, I need to find a way to use a single instance of the ObjectDataSource so that the updates to the two (or more) disparate sets of data can be kept in step. I suspect that if I simply put two data sources on the page, I will get two instances and therefore no correlation between them.This can't be a unique problem, but I'm struggling to find any useful information.

View 3 Replies

DataSource Controls :: Get Value Of Column In Objectdatasource?

Jul 20, 2010

I was woundering if its possible for me to check for accesslevel value from the database using objectdatasouce.... From my coldfusion experience... i could just use an "if statement"

e.g: <cfif> (datasouce.column = x) then
<cfoutput> msg</cfoutput>
</cfif>

Am not so sure about .net.... All i am trying to do is to check for one value on the db and i dont mind puting it on code behind... i just need a way..

View 4 Replies

DataSource Controls :: How To Configure Objectdatasource

Sep 9, 2010

created my own stored procedure in SQL Server for my aspnetdb database which is :

view plaincopy
to clipboardprint?

View 1 Replies

DataSource Controls :: ObjectDataSource With Datatable?

Apr 14, 2010

Could I receive datatable or datarow as objectDataSource update function parameter? I need it because I need the datarow verison functionality to detect change for a column in the update function logic.this is what i had tried:

[Code]....

After I setup the update function in the ObjectDataSource , its DataObjectTypeName has a funny name

[Code]....

View 3 Replies

DataSource Controls :: How To Pass Variable To ObjectDataSource

Sep 10, 2010

I have an objectDataSource which uses my stored procedure GetNotifications

And my GridView is bound to that objectDataSource

the only problem is that my stored procedure requires the variable @UserName and then returns the values for that username, but I do not know how to pass the variable to the objectDataSource, does anyone know the code for this?

I can get userName from HttpContext.Current.User.Identity.Name but how do I pass that to the objectDataSource?

View 7 Replies

DataSource Controls :: How To Get Total Count From An Objectdatasource

Mar 29, 2010

I have a gridview bounded to an objectdatasource.

I want to get total count of record when there is paging = true or false in gridview.

View 4 Replies

DataSource Controls :: Passing Parameters To ObjectDataSource

Aug 9, 2010

I followd Brian Orrell LINQ tutorial for paging/sorting and created a gridview bound to an ObjectDataSource through a method call which gets data from adatabase. My form includes two buttons with a textbox next to each one of them. I need to be able to populatte th egridview depending on the button that was pressed, I cannot figure out how signal my method which button was pressed.
[Code]....
[URL]

View 1 Replies

DataSource Controls :: Can Bind Textbox With ObjectDataSource

Mar 9, 2011

Is it possible for me to have an ObjectDataSource and the bind a texbox to a certain field to it?

View 2 Replies

DataSource Controls :: Is It Possible To Bind DataTable To ObjectDataSource

Oct 31, 2010

is it possible to bind DataTable to ObjectDataSource?

View 4 Replies

DataSource Controls :: ObjectDataSource Binding To Querystring When Don't Want It To?

Sep 23, 2010

I have an ODS control populating a Telerik grid. The ODS definition is pretty simple. It's set to call a method on a static class that has one parameter (entityID). I set this parameter in the OnSelecting event. When I test this, the world is a happy place and all is fine.

Then, I pass a query string to the page (which sets various unrelated values for the page, we'll say parameters X and Y). The page call's Telerik's radgrid.Rebind() event. When this happens, an error is throw from the ODS saying that the underlying method (the static data procedure) does not support parameters X and Y.

So, why is ODS thinking it should be using any querystring values at all when I have explicitly set the entityID parameter (of type Asp:Parameter)? How do I stop this from happening?

The Html:

[Code]....

The OnSelecting:

[Code]....

I see this odsList_OnSelecting being hit and the inspection of e.InputParameters only contains my expected single entry.

View 4 Replies

DataSource Controls :: ConflictDetection In ObjectDataSource Is Not Working?

Mar 10, 2010

I am trying to update record in GridView. But ObjectDataSource is creating original_{0} and new vlaue object (exactly the same).ObjectDataSource.UpdateMethod is as follows

[Code]....

The paremeters ("original_ProductBO" and "productBO") in the above function are supposed to have different values since I am editing record in GridView and then updating it.I have the checked the query by hard coding parameter values and it works. In the ObjectDataSource_Updating(..) event, I cheked the parameters ("original_ProductBO" and "productBO") , I am getting the same values. Can anyone tell why tow parameters have the same values when I am editing record in GridView Code for the ObjectDataSourec and GridView is attached below

[Code]....

[Code]....

View 3 Replies

DataSource Controls :: LocalResourceObject Null When Used By ObjectDataSource

Feb 5, 2010

I have a dropdown list that uses an ObjectDataSource. The select method of the ObjectDataSource needs to localize the TextField, so i create a Dictionary<int, string> and use GetLocalResourceObject as such:

[Code]....

In the Local Resource file, there is status0, status1, and status2, all with a value (Deleted, Active, Inactive). The dropdown and object datasource like:

[Code]....

Now, if I use an ObjectDataSource and put the DropDownList's DataSourceID to it, I will get a null reference on the lookup to the GetLocalResourceObject. BUT If I manually set DataSource/DataBind on the dropdown list on Page_Load, it works fine:

[Code]...

OR If I move the status values to a global resource file and use GetGlobalResource instead of GetLocal, it works fine! Why can I not use an ObjectDataSource and LocalResourceObject in this way?

View 1 Replies

DataSource Controls :: Getting The ID Of The Inserted Item Using ObjectDataSource?

Aug 4, 2010

Im using Objectivation as a DAL with GridView !

I would like to link item when i create it with the InsertMethode :

I have this 2 table :

Item ( id, name )

ItemRelation( idrelation, idParentItem, idSonItem)

I have a page with a gridview with the liste of item in relation with another item (Same table) : Select * From Item where id IN ( Select idSonItem where idParentItem = @TheItem )

When i add an item from this grid i would like to link it with the current Item : So I insert the Item with the GridView InsertMethod then I do another Query an the ItemRelation with idParentItem as the courant Item and the Inserted Item as the idSonsItem !

so the question is : How to get the id of an inserted Item after i get executed the InsertMethod ?

View 4 Replies

DataSource Controls :: ObjectDataSource Update With Parameters?

Feb 16, 2010

http://msdn.microsoft.com/en-us/library/ms178538(VS.80).aspx ?I tried and got error as below, at clicking Update button in detailView

'/CaseExamples' 응용 프로그램에 서버 오류가 있습니다. ==> Server error in application program
ObjectDataSource 'EmployeeDetailsObjectDataSource'에서 매개 변수 (LastName, FirstName, Address, City, Region, PostalCode, original_FirstName, original_LastName, original_Address, original_City, original_Region, original_PostalCode, original_EmployeeID)를 사용하는
네릭이 아닌 UpdateEmployee' 메서드를 찾을 수 없습니다.

View 3 Replies

DataSource Controls :: Configure ObjectDataSource From Code Behind In C#?

Oct 10, 2010

I have an ObjectDataSource and I want to configure it from code behind , I want to set the InsertMethod , Selectmethod from Code Behind and set it to my Business Layer files

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved