Forms Data Controls :: Update DetailsView Data By Updating Object?

Mar 23, 2010

I'm using a DetailsView object to present a record from a database in table format. I'm actually using and ObjectSource object as the data source for the details view. In the object I am using as the source for the ObjectSource, I have paired properties that hold decimals. This is, I have a property called Year1 and another property called Year1Change. This for years 1 to six. The values from the Year1 properties are in a cell, whereas the change values are bound to texboxes. The code for the frontend is the following:

[Code]....

Now, as you can see in the tbYr2RtCh textbox, I have an OnTextChanged property to call an event handler. This is because I want to do two things when the text changes. The first one is to make the font in the textbox bold if the value it holds is different from the Year2 property. The second one is to change the text on tbYr2RevCh to adjust the revenue for the percentage increase in the rate. The problem I have is that I cannot access the object that is the source for the data and make those changes directly in the object, instead of having to update the database. I don't want to update the database until the client says so, but the changes should be calculated immediately. I thought about creating an method in the object that I could specify in the ObjectDataSource as the update method, but I'm still not sure how to go about it.

View 6 Replies


Similar Messages:

Forms Data Controls :: DetailsView BoundFields Auto Binding Not Updating Business Object On Update

Feb 18, 2010

I have a DetailsView (DV) control, an ObjectDataSource (ODS) control, and a button on a page. I have 2 classes in the App_Code directory (Customer and CustomerDAO). The DAO class provides static methods for the ODS control and simply hack values in (ie...no real database selects/updates). The Customer class has 2 properties (Id and Name) and a default constructor. The page takes an ID on the querystring and determines if the DV control is in insert or edit mode. If in edit mode, it sets the SelectParameter on the ODS (id field), calls ODS.Select(), and then calls DV.DataBind(). The existing (although fake) customer is loaded and display properly when this happens. I then change the name of the Customer in the DV and click the Button to save the new data.

Everything seems to be wired up correctly as the UpdateMethod that is specified in the ODS control is called and succeeds (even in my real example with my database). The problem is that the BoundFields in the DV control have not been updated with the new values and therefore the existing values are updated in the database and my changes are lost. I have handled the OnUpdating event of the ODS and the values are still the old values. I have also handled the OnItemUpdating event of the DV control and the NewValues IOrderedDictionary still has the old values in it also. In looking at the MSDN article for the UpdateMethod, it states the following:

Parameter Merging
Parameters are added to the UpdateParameters collection from three sources:

From the data-bound control, at run time.
From the UpdateParameters element, declaratively.
From the Updating event handler, programmatically.

I am using the BoundField classes in my DV control so I would have assumed that the first bullet above would have handled the updating of values, but it doesn't appear to work with the way I am doing it. If I set the values explicitly in the OnUpdating event that is fired by the ODS control (the 3rd bullet) the right values are updated (again...even in my real database situation). It seems like my only issue is that the automatic binding that I expect from the DV control isn't working as I would expect it to. Here is the code that I have in my fake example:

[Code]....

View 7 Replies

Forms Data Controls :: Detailsview Row Update / Creating Dataset, Getting Data From Sql With Adaptor And Filling Into Dataset Object

Dec 21, 2010

I have a detailsview, template as follows:

[Code]....

Codebehind: creating dataset, getting data from sql with adaptor and filling into dataset object, then setting detailsview's datasource.
I add 2 button to above template to able to edit data at asp page, and added event handlers:buttons:

[Code]....

My question is, what to do inside the detailsview update event function to able to edit and update data. My method can be wrong too.

View 7 Replies

Forms Data Controls :: Duplicate Data In Gridview And Updating Textbox In DetailsView

Feb 4, 2010

Duplicate Data in Gridview and Updating textbox in DetailsView

View 2 Replies

Forms Data Controls :: Updating And Deleting Binary Data In DetailsView?

Apr 2, 2010

here is the link [URL]

for the updating and deleting binery data in Gridview same like that i want to updating and deleting data in detailsview?

View 7 Replies

Forms Data Controls :: Detailsview Not Updating After Edit?

Jun 23, 2010

I have a detailsview control linked to a SQL DB. I have created a template field with various controls within. When I click on edit and change the values and press update. The detailsview control changes back to read only and displays the original values. I have attached the code for the control and datasource below.

[Code]....

SQL DATA Source

[Code]....

View 2 Replies

Forms Data Controls :: Detailsview Dropdown Updating?

Jan 3, 2010

I am having issues with this.. If you could help that would be great. I am not a coding expert, but I am trying to learn as I go. I am having problems taking the value from my dropdown list (tabl1) and updating table2 with the selected value.I have my grid / form showing my table2 data, I have 1 of the dropdown fields being populated from table1, when I change the specified dropdown box and click update, the data in table2 stays the same.

View 3 Replies

Forms Data Controls :: How To Stop A Detailsview From Inserting Or Updating

Aug 12, 2010

Here is the scenerio:I have a radtabstrip (with 2 tabs) at the top of my page followed by radMultiPage control Tab 1 displays pageview 1 which has a gridview showing data from our database and allows for selection or deletion of data tab 2 displays a detailsview when gridview_selectedindexchanged(from tab 1) is fired.Problem... If you select an entry in the gridview it switech the page and the detailsview into editmode (works fine) but if you then click on tab 1 without clicking update or cancel in the detailsview, the data is updated. This is what i don't want as the user has basically abandoned the changes.So what i need is a what to say ... if the detailsview is in edit or insert when the tabstrip is clicked then cancel the insert or update. I tried switching it back to readonly mode but that did not seem to work.

View 2 Replies

Forms Data Controls :: Detailsview Not Updating If Gridview Not Visible?

Dec 14, 2010

I have a master/detail page using a gridview as the master, and a detailsview as the details. The gridview is set to select a record, and the detailsview picks up the ID and you can either edit that record, or add a new one.The detailsview is set up with various template fields, and if everything on the page is visible, it works OK.However, I wanted to hide the Gridview when the user in working with the detailsview. But if I do that, the detailsview doesn't update the record.

View 2 Replies

Forms Data Controls :: All Row In MS Access Table Are Updating With Detailsview Edit?

Nov 22, 2010

I have used this before with no issues. Now I get to the page with the detailsview using parms I pass with the key to the row. When the page opens the row I want to update is displayed.

I am having 2 issues. One when I change any of the fields and hit Update (the Edit button),

all rows are updating not just the row displayed. The second problem is I have an update_date and an Updated_by field with code in code behind in the Onitemupdating event and they are not updating at all. (This bit of code works fine in another page I have to updated similar fields on an insert).

View 5 Replies

Forms Data Controls :: Control - Datalist Update Using The Update Button Outside The Detailsview

Feb 4, 2011

I have a gridview and when i click on the edit button i will get the modalpopup window which is having a popup window i want to update the data in that details view and refresh the data into gridview also.

View 2 Replies

Forms Data Controls :: Updating Two Detailsview Controls With Paging?

Mar 11, 2010

have two detailsview controls on the same page, one showing pictures, one showing the comment on the current picture. I separated them because they are in different parts of the page (just in case someone was wondering why). They both bind on the same objectdatasource. The issue is that since I use paging to navigate the pictures and i dont know how to also update the comment detailsview control to the same page as the picture.

View 3 Replies

Forms Data Controls :: Updating A Currency Field Of An Access Table Through Detailsview, Cannot Input Decimals

Oct 23, 2010

I changed a text field to a template field assigning the selected text and the selected value is being assigned to another currency field also templated. I get aa error

[FormatException: Input string was not in a correct format.]

View 10 Replies

Forms Data Controls :: Detailsview Entity Framework Cannot Update Existing Data?

Mar 30, 2011

I use a Detailsview, Entity Data Source to edit/update my table with only 3 columns.(it has primary keys).

Everything works fine inserts/edit in dev environment. but when i run this in release mode. i cannot update existing data in the database with the detailsview. whenever i update and save page gets refreshed, but nothing gets updated. but whenever i insert a new record, and then i try editing it. it works.?

Note: i handle DetailsviewItemUpdating,DetailsviewItemInserting events to do some custom checks.

View 1 Replies

Forms Data Controls :: Restrict User To Update Data To Some Text Boxes In Detailsview?

Jan 3, 2010

I have a detailsVeiw bounded with the sqldatasource.I want to restirct user to update all data in text boxes.

Or in words if user click Edit then it is required to show some text boxes to update and other should be read only.

How to do this task in asp.net.

View 3 Replies

Forms Data Controls :: Object Not Set Error When Updating?

Oct 17, 2010

I get the error: Object reference not set to an instance of an object when i perform an update on my datalist?

View 6 Replies

Forms Data Controls :: Binding And Updating Object Via Formview?

Mar 1, 2011

I want to bind an object to a form view.

[Code]....

Now, is it possible to generate a new object on update, without getting and reading each textbox with findcontrol?

View 6 Replies

Forms Data Controls :: Casting Object In DetailsView Template Table?

Jul 22, 2010

I use the DetailsView control to display selected employee's data for HR. The list of data elements has gotten pretty long so I thought I'd put some tables & panels inside the ItemTemplate and EditTemplate. Testing with NO code behind in effect works perfectly on display & update. Now I need to manipulate some stuff in the code behind which requires me to cast the controls I'm after. However old cast code doesn't work (it says the row index doesn't exist).

First is a clip of the DetailsView which gives me 3 nice columns.

[Code]....

View 2 Replies

Forms Data Controls :: Stop An Update In A Detailsview

Jan 11, 2010

I have an update button in a detailsview. based on certain criteria in the data that is being updated (blank field), I want to stop the update from happening. I tried putting the following code in my UpdateButton: 'check to see if the status is 'complete'

Dim statuscheckbox
As CheckBox =
TryCast(formulationDetailsView.FindControl("FormulationCompleteCheckBox"),
CheckBox)If statuscheckbox.Checked
Then
'check to see if color code has been entered
Dim colorcodetextbox
As TextBox =
TryCast(formulationDetailsView.FindControl("ColorCdTextBox"),
TextBox)If colorcodetextbox.Text =
""
Then
'show a message, the color code has not been entered
MessageBox2.Text = "Please enter Color Code prior to complete"
statuscheckbox.Checked = False
resetformwithoutediting()
End

how to stop this code from proceeding to the update?

View 5 Replies

Forms Data Controls :: Detailsview Wont Update?

Apr 29, 2010

I am trying to update a record using a details view. When the update button is pressed nothing happens, even if I check the db then the record is all the same. No error occurs but there is no update. I am using OLEDB connection with a db2 DB.

<asp:Panel ID="pnlLayerDetails" runat="server" Height="142px" Width="474px">
<asp1:UpdatePanel ID="updpnlLayerDetails" runat="server" UpdateMode="Conditional" >
<ContentTemplate>[code]....

View 9 Replies

Forms Data Controls :: Update DetailsView Programmetically C#

Nov 19, 2010

How can I programmatically Update Details View. NOT through SQL DataSource or through Wizard. I want to Update the Details View from Code- Behind (.cs)

I have a Drop down list loaded with UserNames, Up on Selecting the UserNAME, I am loading the Details View with User Information.Now I want to Provide Update faeture programmtically.

View 9 Replies

Forms Data Controls :: DetailsView To XML File On Update

Oct 31, 2010

I've got a DetailsView control with Edit and Update enabled. I'd like to write the edited record to an XML file after Editing. What's the best way to do this? I thought I could write to a text file and concatenate the db fields between XML tags but is there an "automatic" or best practice way to do it?

View 2 Replies

Forms Data Controls :: Update Statement Not Updating?

Jul 11, 2010

I have a simple table. (with PK). I have created a tableadapter that selects all fields and filters with a control parameter. This works fine. The results are displayed within a DetailView control. All okay up to this point. I have then enabled 'Editing'.I can then click on the edit and change the text, but when I click the edit button the page updates but the value has not changed in the database?

View 4 Replies

Forms Data Controls :: Detailsview Update Method Not Getting New Values?

Jun 9, 2010

when I click on "update" button of my detailsview I have the same values on my db table.It seems that the update method don't get my new values inserted in the "boundields" in editing mode.Below there is my code.

<asp:DetailsView ID="detailsview1" runat="server" AutoGenerateRows="false" HeaderStyle-Font-Bold="true"

View 2 Replies

Forms Data Controls :: Update Multiple Tables From DetailsView?

Nov 29, 2010

I have a asp:DetailsView control with the first column are the field headers and the second column is the record details for a given user.

The DetailsView is bound from 4 tables, I need to be able to edit/amend any field. Is there another way I can achieve this from the DetailsView? Would I need to create templates for each table entry then Update SET on each template, would that do it?

View 8 Replies







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