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


Similar Messages:

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

Forms Data Controls :: Way To Update For A Manually Bound GridView

Mar 3, 2010

I am having a hard time updating from my gridview based the value that I am setting in the datakeynames it is the Ucc field I keep getting and index out of range exception on the e.keys[0]. I have done this before so I am confused what I am missing here.

View 8 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 :: Gridview Update - Bound Fields Visible Set To False Not Working?

May 20, 2010

I have an Objectdatasource configured with Select, Insert, Update & Delete queries in a Dataset. This datasource is linked to my Gridview. I do not require all fields in the table to be displayed or updated in my grid so i have turned off the Visible property on several.

However, when i go into Edit mode and trigger the UPDATE to the database table, i get NULL values updated in the columns i set False for the Visible property.

How can i remove these columns from the GridView and the Edit mode and still have them UPDATE with their current values instead of being overwritten with NULL's?

View 6 Replies

Forms Data Controls :: Search GridView And Update The Row That Was Found?

Oct 11, 2010

I have a gridview that populates from a sqlDataSource I added a textBox and a button to input company name in a textBox and click the button to search. Once the row with company is found I want to update it, but when I click update in this row, the gridview displays all of the rows, and instead of the one fromthe search results, the first row at the top is displayed in update template.The GridView first is populated from a static sqlDataSource (EditDistributor), that displays all of the columns in a table.

[Code]...

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 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

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 :: 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

Forms Data Controls :: Read Only Bound TextBox Does Not Update?

Jan 12, 2010

I have a TextBox in a nested FormView that I want to use for entering a date. I have added a calender extender to the TextBox and I want to set TextBox to read only so that the date can only be entered by using the calender extender. This way I can avoid improper date formats.

The problem is that when I enter a new date and click the Update button, the new date is not saved to the database. I have done some searching on the WEB for a solution, and I found that "Page.Form.SubmitDisabledControls = True" is used in the Page_Load event to solve this problem. I have tried this and it does not work.

Another solution that I have seen is to set the control to readonly at runtime in the FormView "ItemCreated" event. I have been unable to access the "ItemCreated" for this FormView because it is nested.

View 2 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 :: Display A One Row Gridview When Gridview Is Bound To Empty Dataset

Jan 13, 2010

If the gridview binds to empty dataset, I need to still show a gridview so that users can ADD more using the textfields in the bottom of the footer template. Since the gridview is empty it won't bind not allowing rendering of the <footer template> I guess I should create a empty dataset if the gridview is empty. How do I check for this and can this be done in GridviewRowEventArgs

View 5 Replies

Forms Data Controls :: How To Get The Row Value Of Gridview Upon Bound

Jul 2, 2010

I got his code for RowDataBound

[Code]....

View 4 Replies

DataSource Controls :: FormView Bound To LinqDataSource Shows Data But Won't Update Database

Feb 10, 2011

I have a FormView bound to LinqDataSource, that is intended to allow editing of a single product's details, that is selected from a GridView. The LDS has a Where parameter set to point to the GridView control (i.e. a ControlParameter).

View 1 Replies

Forms Data Controls :: Get ID Bound To Label In GridView?

Feb 10, 2010

I have a foreign key (TeamID) in a GridView. I use a TemplateField to display it as the lookup value (TeamName) in a label, and a dropdown for editing. When row is selected and SelectedIndexChanged is fired, I want to access the TeamID. I can get the TeamName from the label. I tried putting the TeamID in DataKeyNames, but that fouled up my dropdown when saving (it reverts to the original value). So, how can I get the TeamID?

View 1 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 :: Possible To Put Filters On Gridview Which Is Bound To A Datatable

Apr 18, 2010

what it is i have a datagrid bound to a datatable.This datatable fills from a sql table. This datatable will have 2 columns which is 'part' and 'description'.What it is I want to have a couple of chk boxes next to the datagrid which will filter it by column 'part'.The issue is the datagrid will have about 1000 records so i dont want to do a for next loop searching for field part for a certain filter

View 1 Replies

Forms Data Controls :: Paging With An GridView That Is Bound To A Dictionary?

Mar 4, 2011

I have a Dictionary and I bind it to my Grid view...

[Code]....

But its not paging at all... is it even possibe to page if you are bound to a Dictionary?

View 4 Replies

Forms Data Controls :: How To Add A Boundfield To A Gridview After It Gets Bound To A List

Feb 8, 2011

DLRepository is a class with method getDLandRules. I am binding the gridview with the list that is returned by method. Now I would like to iterate through the list and add 1 more column to each row that is returned. currently, I am getting an error

GridView1.Rows[row].Cells[7].Text 'GridView1.Rows[row].Cells[7]' threw an exception of type 'System.ArgumentOutOfRangeException' strin

View 4 Replies

Forms Data Controls :: Gridview (bound By ObjectDataSource) Sorting

Aug 31, 2010

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.

View 2 Replies

Forms Data Controls :: Bound Textbox Not Populating In Gridview?

May 25, 2010

I have a Gridview that has a template field containing a bound textbox (fieldname is 'Status'). I have an extra column containing an update button, which is designed to update the db with whatever is in the textbox.

What's happening is that when I load the form, the textbox is blank, even though there is existing data in the fields. If however I click the update button, all the textboxes in the Status column update and populate with the correct data from the database. I guess my question is why would bound textboxes not populate until an update command is run?

View 19 Replies







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