Forms Data Controls :: Gridview Update / Delete Command Like A Update Command?

Apr 26, 2010

how would i do my Gridview delete command like a update command?

im using a datasource... and my delete command is like my update command... so i can change the status into "INACTIVE"...

DeleteCommand="UPDATE ACCOUNT_MAINTENANCE SET am_status = 'INACTIVE' WHERE (accmain_no = @accmain_no)"

UpdateCommand="UPDATE [ACCOUNT_MAINTENANCE] SET [account_type] = UPPER(@account_type), [min_deposit] = @min_deposit, [min_capital] = @min_capital WHERE [accmain_no] = @accmain_no"

when i press my delete command at gridview... the status changed into "INACTIVE" but when i refresh or press f5... it automatically update the status into "INACTIVE" also...

View 3 Replies


Similar Messages:

Forms Data Controls :: GridView Update And Delete Command Button Does Not Trigger

Apr 3, 2010

I have 3 gridviews in one of my web page, each of which will display different data based on the typeid. I have simplified the system structure in the image below(further description will be stated below the image):

As shown in the image above, the web site(presentation layer) will work closely with the Business Logic layer(BLL) and Data Access Layer(DLL). ObjectDataSource control will be the middle man to select, update, insert and delete the data in the gridviews.

During Select, returned data from the database at DAL will be stored in a datatable and return to BLL and then the website itself.

[code]....

However, the Update(command button) and Delete(template field) doesn't work,the RowUpdating and RowDeleting event wasn't trigger when I click on the button, but it works if I set the gridviews' datasourceid to the objectdatasource.

View 6 Replies

Web Forms :: GridView Update And Delete Command Button Doesn't Trigger

Apr 3, 2010

I have 3 gridviews in one of my web page. I have simplified the system structure in the image below(further description will be stated below the image): As shown in the image above, the web site(presentation layer) will work closely with the Business Logic layer(BLL) and Data Access Layer(DLL). ObjectDataSource control will be the middle man to select, update, insert and delete the data in the gridviews. During Select, returned data from the database at DAL will be stored in a datatable and return to BLL and then the website itself.

The data in the returned datatable will be filetered by type using RowFilter method and stored into the 3 dataviews. Each dataview will act as the datasource for the 3 GridViews respectively, and therefore I specified the datasource programatically instead of setting the datasourceid for each gridview.

dataview1 = New DataView(dtSelectedTable)
dataview1.RowFilter = "Type='1'"
GridView1.DataSource = dataview1
GridView1.DataBind()
dataview2 = New DataView(dtSelectedTable)
dataview2.RowFilter = "Type='2'"
GridView2.DataSource = dataview2
GridView2.DataBind()
dataview3 = New DataView(dtSelectedTable)
dataview3.RowFilter = "Type='3'"
GridView2.DataSource = dataview3
GridView2.DataBind()

However, the Update(command button) and Delete(template field) doesn't work, the RowUpdating and RowDeleting event wasn't trigger when I click on the button, but it works if I set the gridviews' datasourceid to the objectdatasource. I couldn't figure out why, hope that someone who have come across the same problem couldn't provide some guidance.

View 5 Replies

Forms Data Controls :: Use An Update Command Within GridView?

Sep 26, 2010

I am trying to use an Update Command within my GridView. I need to find the "FindControl" for the Edit Command textboxes.

Ie. When the user clicks the Edit button, the row is populated with dropdown boxes, textboxes, etc for editting. Then when the user clicks on Update (button) and the GridView1_RowCommand function is activated with 'if (e.CommandName == "Update")' statement with my FindControl. etc. and my sql UPDATE command statements are used. How do I convert my FooterRow info to my Edit FINDCONTROL info?

This is what I have:

[Code]....

View 3 Replies

Forms Data Controls :: Gridview Update Command In C#?

Aug 6, 2010

i am using edit,update,cancel command in gridview, i need to update value in bound field how to retreive that value.

View 7 Replies

Forms Data Controls :: Update Gridview Command With Customized Parameters?

Mar 22, 2011

I have a asp.net gridview control on my page with several fields and a couple of command fields. However, the update command is giving me problems.

Here is what works. The update command works provided I put straight text into the textboxes that appear. I even have one field that contains a dropdown list which works fine.

Here's the problem. I have two fields that need to access their value programmatically. These fields will reflect the current datetime and the current loggedin user from active directory. I have already created public strings in the C# code.

When I run the edit command on the asp form the grid uses one "DataKeyNames" element. With this the grid can update the selectedrow. However, I haven't been able to access it programmatically in the C# code. I can access the selectedrow in the "selectedindexchanged" event but then I am not able to update my fields in the gridview itself. So, part one of my question is how to I access the "DataKeyNames" properties of a gridview control.

if I can't access the "DataKeyName" property perhaps I could set the label nested within the gridview to the "myCurrentUser()" public string. I am inserting my code to hopefully make this clearer.

View 2 Replies

Forms Data Controls :: GridView Not Updating / After Clicking Update Command Field?

Mar 12, 2011

I have a gridview and sqldatasource in a form. My sqldatasource has select,delete and update command. The delete command is working but the update doest not work when I click the update command field.

Here is my code [Code]....

View 3 Replies

Forms Data Controls :: Insidious Bug Found For A Bound Gridview With UPDATE Command?

Feb 17, 2010

Bug: UPDATE command Does NOT Work as Expected on a DataBound GridView This was tested in VS2005 and VS2008

Took a while to figure this out - A simple recurse thru Page Controls Makes UPDATE Not Work as expected.

To Recreate this bug:

A simple Gridview bound to an Objectdatasource on a page with ALLOWEDIT ALLOWDELETE

If one inserts some code (a function call in my example) that just recurses the PAGE controls in either the PAGE_PREINIT, PAGE_INIT, PAGE_INITCOMPLETE events,

Then the UPDATE does not FIRE! and After Pressing UPDATE the GRID does not BIND! You Get A Blank Page - Funny thing tought it's only the UPDATE Functionality that gets affected by this - Everything else works fine including EDIT & DELETE.

If the same function call (recurse thru page controls) is added in the PAGE_PRELOAD, PAGE_LOAD -- Then the UPDATE starts working again as expected.

BELOW Is SAMPLE Code using the NORTHWIND DB Products Table and a Typed DATASET.XSD - You can use your own datasource for the ObjectDatasource - (Note I took out the Foreingkey constraint in products table from Nortwind for delete to work)

NOTE: One should be able to just cut and paste the function PAGECONTROLS_RECURSETEST on any working form that has a bound Gridview with Update functionality and you should be able recreate the bug that way by calling the function from the different page_events

[Code]....

View 1 Replies

Forms Data Controls :: Update A Colums Value Of A Row In A Gridview On Row Command Event Handler?

Aug 11, 2010

How to update a colums value of a Row in a gridview on Row Command Event Handler. I am using a SQL Datasource.

[Code]....

View 5 Replies

Is It Necessary To Do Select Command Before Update Command In OracleDataClient

Aug 19, 2010

I've recently started working in ASP.NET and RDBMS.I'm making a test form where I can do basic add,update,delete operations.I'm using OracleDataClient to do the DB operations.I was able to populate a listbox using OracleDataAdapter.

Now after clicking on update button,I intend to Update in DB.I've Dataadapter with it's update property.But the update query is not happening.The examples I saw over net all have Select command before Update.Is it actually like that or am I missing some point.

How does Oracle DataClient work with Insert,Update,Delete Commands.

View 1 Replies

Forms Data Controls :: Update XML With Textbox And Command Button?

Apr 8, 2010

I'm trying to create a ShoutBox for my site, and for those of you who are not familiar with shoutboxes, they are chat boxes on websites that users can post live messages on, and the other uses will see their message and be able to respond. I didn't find any good ones online, so I started to write my own. I'm doing it with an XML, but I want the user to be able to post messages using a textbox I added (txtMessage) and the button (cmdPostMessage), which should add a new item to the XML file, and all the other uses will receive that message (their xmlDataSource and the DataList will PostBack every second or something like that). It is able to read messages, but not send.I am however facing three problems:

1- I need to find a way for the user's input to be added to the XML.

2- I need to find a way for the current logged-in username to be found, and added to the XML, and also detect if no user is logged in, in which case the user wil receive an alert saying "Please log in to post messages to the ShoutBox" and redirect them to the login page.

Here is the text in the XML

[Code]....

View 1 Replies

Forms Data Controls :: Update Command Not Updating In Base?

Jul 12, 2010

I am using asp.net(C#) as platform for building my application. I want to update the values in the database for the particular user & using the following code:

[Code]....

when I run this code, it works perfectly fine & there's no error, but when I check into the database, the values do not change & remains same. The default value in the database is NULL.

Kindly check into the matter & revert ASAP.

View 1 Replies

Forms Data Controls :: Datagrid To Call Itemcommand Or Update Command?

Mar 31, 2010

I use the following with datagrid to call itemcommand or update command etc, and i do this:

If e.CommandName = "doAdd" Then

End If What is the equivalent check in gridview?

View 3 Replies

Forms Data Controls :: Adding Delete Command Btn To Gridview

Jan 10, 2010

I have some simple shopping cart using DataTable and Session, all data are in datalist after user click "Add" the record go to gridview. how can i add delete button to delete row from the gridview?

aspx.cs:

[Code]....

aspx (gridview):

[Code]....

View 4 Replies

Forms Data Controls :: Nested Gridview Delete Command Not Working

Apr 8, 2010

I'm a novice programmer and I have this situation: I have a nested Gridview, and I want to be able to DELETE the records in the nested Gridview. I have no problem inserting new records with the nested gridview, but it does not execute the DELETE Command on the SQL Datasource. I checked that the DATAKEYNAME on the nested gridview includes the the parameter that is used in the DELETE SQL Command on the SQL Datasource for that Gridview. But it seems to me that the parameter value is not being passed to the SQL Datasource by the nested gridview. Maybe I need to use a difference approach to execute this on a nested gridview compared to a regular gridview.

View 4 Replies

Forms Data Controls :: Deleting From GridView Without Call Datasource's Delete Command

Jan 21, 2010

I'm using the asp.net membership on my website. On the User Administration page i've got a GridView to show the details of the users on the site. As a datasource rather than just using the Membership.GetAllUsers function i've got a SQLDataSource as i need to display user information from 3 different tables. I'm trying to add a delete button to the GridView. I'm setting the Membership's UserName as a DataKey and then using the RowDeleting event to call Membership.DeleteUser for the appropriate UserName. This works fine and the user is deleted however i then get an error showing up that "Deleting is not supported by data source 'SqlDataSource1' unless DeleteCommand is specified."

I don't want to use the SqlDataSource for deleting as i've already done it using the Membership. How can i stop it from trying to do this? Here is the cut-down that i have if you're interested. The selectcommand in the sqldatasource was auto-generated by it.

[Code]....

View 5 Replies

DetailsView Update Command Doesn't Update Unless All Of The Fields Are Present?

Nov 16, 2010

I have a page that binds data from DB to a DetailsView.I want to use the auto-generated Update command.

Everything went OK, and also updating was successful, but if I remove any field that I don't want to have chance to update, then the Update command doesn't update! the old values retain!

I mean: if all of the fields are present in the detailsView, the update will be OK, otherwise, the update will NOT update any thing.I've tried to mark the fields that I don't want to view as "Visible = 'false'" but with no good results!

View 2 Replies

Using GridView Update Command For Specific Fields?

May 4, 2010

How do I use the Update command in GrideView?

I would like to use update command for specific fields in the dataset, but not all fields from database ( or maybe in GridView? )

View 1 Replies

Forms Data Controls :: GridView Delete Command Fires Error When Using Template Fields Inside

Mar 6, 2011

I have visual 2010 with net 3.5 web app. I was implementing EntityFramework in my project and added a gridview to a entity source control. It worked ok, with select, update, and delete buttons enabled on the grid. But then, i needed to add a template field bound to a Foreign table, so my users select value from a list instead of writing the code. After that, my app fires error when i delete. I tried everything, inclue dakeyNames, write code on my RowDeleting, RowDeleted, RowCommand, but error persists.

Now, i can delete the row, but it then i get the error Object reference not set to an instance of an object If i implemente delete code on RowCommand i get the error: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.

View 1 Replies

Web Forms :: Update Two Table Data With Single Command

Feb 20, 2013

I have two tables in oracle ,

i want to update two table data in a single command...

View 1 Replies

GridView - Update Row Command Does Not Revert Back To Display-only

Jan 19, 2010

I have a GridView that is populated from a LinqDataSource. When I update a row, the RowCommand fires and the change is persisted to the database, but the Grid does not refresh. I have it in an UpdatePanel and explicitely call Update() in the RowCommand handler, but there is no postback and the page just sits there in Edit mode. Once I click cancel, it will return to view-only and the grid shows the new value.

something in the wiring of the GridView regarding the data source is wrong. No exception bubbles up, though. A stripped-down copy of the markup is below.

[code]....

View 3 Replies

DataSource Controls :: Update Command Is Not Working?

Jan 17, 2010

given below is the simple update string am using to update my database...

string q = "update register set fname='" + TextBox1.Text +
"',lname='" + TextBox2.Text +
"',gender='" + gender +
"',edu='" + TextBox3.Text +
"' where username='"+check +"'";
cmd.ExecuteNonQuery();
SqlCommand cmd =
new
SqlCommand(q, cn);

but it is not working...database is not getting updated...why?

View 2 Replies

ADO.NET :: Data Adapter Update Method With Command Builder

Nov 11, 2010

Code:

SqlDataAdapter da = new SqlDataAdapter("select * from " + txtTableName.Text, DataStoreGeneral.GetConnectionString());
DataTable dt_app = new DataTable();
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.FillSchema(dt_app, SchemaType.Source);
da.Fill(dt_app);
SqlCommandBuilder build = new SqlCommandBuilder(da);
da.InsertCommand= build.GetUpdateCommand();
da.Update(ds.Tables[1].GetChanges(DataRowState.Added));

Problem: In my scenerio i had dataset with a table (in code->ds.Tables[1]) in rowstate added. I wanted update on database with this table so i changed insert command of adapter to update command of command builder, but no update got performed. When debugged in sql profiler i found that update command generated by builder is checking all columns in where clause and with parameter value of data table instead of from database column value.

exec sp_executesql N'UPDATE [ShopResources] SET [GROUP_RESOURCE_ID] = @p1, [SEQ_NO] = @p2, [SUB_RESOURCE_ID] = @p3, [EFFICIENCY_FACTOR] = @p4, [RUN_COST_PER_HR] = @p5, [RUN_COST_PER_UNIT] = @p6, [BUR_PER_HR_SETUP] = @p7, [BUR_PER_HR_RUN] = @p8, [BUR_PERCENT_SETUP]
= @p9, [BUR_PERCENT_RUN] = @p10, [BUR_PER_OPERATION] = @p11 WHERE (([GROUP_RESOURCE_ID] = @p12) AND ([SEQ_NO] = @p13) AND ([SUB_RESOURCE_ID] = @p14) AND ((@p15 = 1 AND [EFFICIENCY_FACTOR] IS NULL) OR ([EFFICIENCY_FACTOR] = @p16)) AND ([RUN_COST_PER_HR] = @p17)

AND ([RUN_COST_PER_UNIT] = @p18) AND ([BUR_PER_HR_SETUP] = @p19)

The problem I identified is parameter values inside where clause are from data table which is obvious that update condition will not be met. Is there some way to restrict where clause to primary key only in Command Builder?Or why is command builder taking where clause parameter values from datatable instead of command (query)?

View 2 Replies

Data Controls :: Delete With Confirmation Using Details View Delete Command Button

Nov 7, 2011

I am interested in building an intranet document management system to be used from Internet Explorer using ASP.net, VB.net, and MS SQL Server but have no experience in doing a project like this. Supported file types would be txt, pdf (from scanner or imported from file system), or jpg. What concepts I should look at researching/learning about to build the system in a way that files will be stored as small as possible, retrieved and displayed quickly, and secured. The users would be spread out over a regional area covering 4 states.

View 5 Replies

Data Controls :: Delete With Confirmation Using DetailsView Delete Command Button

Jan 7, 2014

I want to make an conformation dialog on auto generated delete button in detail view that when user press delete dialog or conformation box appear that u sure u want to delete how can i do this? 

View 1 Replies







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