setting a column value in code for an updatable ViewGrid

Is there a way to set the value for a column in code when a ViewGrid row is 
edited?  I have a row-last-updated date that is a required audit field in 
all our systems (required by data management).  I don't really want the user 
updating this field as it should always be system controlled.  If I create 
an editable ViewGrid tied to either an SqlDataSource or an ObjectDataSource, 
the field seems to only be updatable by the user.  I can set it the first 
time by setting the DefaultValue in code but that has no effect after there 
is an initial value in the column.

Do I need to completely take over the editing of the data in code?

Thanks,
=================================
Ray Porter
Information Systems
Applications Development Manager
Division of University Advancement
University of North Carolina at Chapel Hill
Phone: (919) 259-9389
Fax: (919) 843-3314
Pager: (919) 216-4218

ray_porter@unc.edu
http://www.unc.edu/~dragon

Meddle not in the affairs of dragons for thou
art crunchy and taste good with ketchup 


0
Ray
9/1/2010 11:04:25 AM
dotnet.framework.aspnet 1425 articles. 0 followers. Follow

2 Replies
517 Views

Similar Articles

[PageSpeed] 59

You could create a business class that your ObjectDataSource is tied to with 
an update method and set the date in that Update method.

Example: in this example, I'd have a TasksTable adapter defined in the 
Requests dataset and TasksRow would be a member of that dataset.

<System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, 
False)> _
   Public Function Update(ByVal dr As RequestDS.TasksRow) As Boolean
      dr.mYDate = Now()
      Dim b As Boolean
      Try
         Adapter.Update(dr)
         b = True
      Catch ex As Exception
         b = False
      End Try
      Return b
   End Function

"Ray Porter" <ray_porter@unc.edu> wrote in message 
news:uXb1xVcSLHA.620@TK2MSFTNGP06.phx.gbl...
> Is there a way to set the value for a column in code when a ViewGrid row 
> is edited?  I have a row-last-updated date that is a required audit field 
> in all our systems (required by data management).  I don't really want the 
> user updating this field as it should always be system controlled.  If I 
> create an editable ViewGrid tied to either an SqlDataSource or an 
> ObjectDataSource, the field seems to only be updatable by the user.  I can 
> set it the first time by setting the DefaultValue in code but that has no 
> effect after there is an initial value in the column.
>
> Do I need to completely take over the editing of the data in code?
>
> Thanks,
> =================================
> Ray Porter
> Information Systems
> Applications Development Manager
> Division of University Advancement
> University of North Carolina at Chapel Hill
> Phone: (919) 259-9389
> Fax: (919) 843-3314
> Pager: (919) 216-4218
>
> ray_porter@unc.edu
> http://www.unc.edu/~dragon
>
> Meddle not in the affairs of dragons for thou
> art crunchy and taste good with ketchup
> 


0
SAL
9/1/2010 4:42:15 PM
Thanks.  I'll look into that option.

Ray

"SAL" <SAL@nospam.nospam> wrote in message 
news:%23sMAjSfSLHA.2068@TK2MSFTNGP05.phx.gbl...
> You could create a business class that your ObjectDataSource is tied to 
> with an update method and set the date in that Update method.
>
> Example: in this example, I'd have a TasksTable adapter defined in the 
> Requests dataset and TasksRow would be a member of that dataset.
>
> <System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, 
> False)> _
>   Public Function Update(ByVal dr As RequestDS.TasksRow) As Boolean
>      dr.mYDate = Now()
>      Dim b As Boolean
>      Try
>         Adapter.Update(dr)
>         b = True
>      Catch ex As Exception
>         b = False
>      End Try
>      Return b
>   End Function
>
> "Ray Porter" <ray_porter@unc.edu> wrote in message 
> news:uXb1xVcSLHA.620@TK2MSFTNGP06.phx.gbl...
>> Is there a way to set the value for a column in code when a ViewGrid row 
>> is edited?  I have a row-last-updated date that is a required audit field 
>> in all our systems (required by data management).  I don't really want 
>> the user updating this field as it should always be system controlled. 
>> If I create an editable ViewGrid tied to either an SqlDataSource or an 
>> ObjectDataSource, the field seems to only be updatable by the user.  I 
>> can set it the first time by setting the DefaultValue in code but that 
>> has no effect after there is an initial value in the column.
>>
>> Do I need to completely take over the editing of the data in code?
>>
>> Thanks,
>> =================================
>> Ray Porter
>> Information Systems
>> Applications Development Manager
>> Division of University Advancement
>> University of North Carolina at Chapel Hill
>> Phone: (919) 259-9389
>> Fax: (919) 843-3314
>> Pager: (919) 216-4218
>>
>> ray_porter@unc.edu
>> http://www.unc.edu/~dragon
>>
>> Meddle not in the affairs of dragons for thou
>> art crunchy and taste good with ketchup
>>
>
> 


0
Ray
9/1/2010 5:17:03 PM
Reply:

Similar Artilces:

Updating "pivots"
It seams that ActiveWorkbook.RefreshAll dos not update pivot tables! Any hints You sure. VBA's help does have this remark: Remarks Objects that have the BackgroundQuery property set to True are refreshed in the background. And if you click on BackgroundQuery, you'll see this sample code: Worksheets(1).PivotTables("Pivot1") _ .PivotCache.BackgroundQuery = True Jens wrote: > > It seams that > > ActiveWorkbook.RefreshAll > > dos not update pivot tables! > > Any hints -- Dave Peterson Hi Jens Try Sub RefreshAllPivots() Dim pc As Piv...

rows to be copied to next sheet based on value of particulkar cell
hi, What I want to do in my workbook is data in rows copied to next sheet based data in Column F (date) of row. The copied data must be in copied to same row in next sheet. Column F contain date. If date is same month as current date. date should not be copied to next sheet but if date is not the same as current month then the whole row should be copied to next sheet. Every sheet correspond to one monthm so total of 12 sheets. tabylee -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/excel-new/201001/1 ...

loaded bitmap not having background set
Hi I am adding column sorted indicator arrow to a CListCtrl in report mode. I can get the bitmap to be shown in the listctrl header but the white background is not being set to transparent like the LR_LOADTRANSPARENT should make it. The white background pixels are in the bottom left hand corner of the bitmap as required. The code that should work is: hb = (HBITMAP)LoadImage(GetModuleHandle("Maint.dll"), MAKEINTRESOURCE(IDB_UPARROW), IMAGE_BITMAP, 0, 0, LR_LOADTRANSPARENT | LR_SHARED); The above code and bitmap resource are in the dll mentioned in the GetModuleHandle. The dll is ...

How do I set up an Income Acount?
I get income from several companies; I want to set up income accounts in various categories; ie Securities Amazon Herb Co. Bonus Individual Life Insurance Individual Health Insurance Group Insurance Please help, Don Income is generally treated with categories, not accounts. "Income accounts in various categories" is a non sequitur. Categories are categories. Accounts are accounts. What you may be looking for is "classification." With classification, you could apply a category to income like "Wage & Salary:Bonus" and a classification like Class: Income S...

Request Failed with HTTP status 403
When I'm on the server as admin and I go into settings>Organizational settings>System Settings, I get the error and stack trace (at least the part I can get to) below: Server Error in '/' application. The request failed to load with HTTP status 403: Forbidden Description: An unhandeled exception occurred during the execution of the current web request. Please review the stack trace for more information... Exception Details: System.Net.WebException: The request failed with HTTP status 403: Forbidden. Source Error: An unhandled exception was generated during the execut...

Updating VBA function?
Is there a way to update this function so that it executes the same set of criteria for the data on line 32, 45, 58 and so on? In other words, every 13th line has a different set of data of that I would like to have analyzed in the same way that this function analyzes the data in line 19? Everywhere line 19 and 7 is listed, the next group is line 32 and line 7 is line 20 and so on. Private Sub Worksheet_SelectionChange(ByVal Target As Range) 'make whole sheet the target If Target.Column > 0 Then 'clear previous answer answer = "" 'see what lookup code has been g...

Automatically update cells in worksheets
Excel newbie here hoping someone can point me in the right direction... Have a workbook that contains 3 worksheets... ws1: Is a work detail list I enter the date and unique ID no. and Company Name. ws2: Contains a list of the first 30 Companies I have to visit each month, and contains all the Company details such as address, tel no, ID no., ws3: Contains a full list of all Companies within the area I'm working that month, including the initial 30 dealers. Now what I'm trying to do is when I enter the Company Name in ws1 it will automatically update Format conditions in ws2 and 3.....

Defining Registry Setting Automatically
I am creating an application and was wondering how you can define the registry settings for the hooks automatically when the application is loaded. For example - increasing the hook count by 1 and using the value to set my hooks for my application TIA John "John" <John@microsoft.discussions.com> ha scritto nel messaggio news:uwsZYMYqFHA.2592@TK2MSFTNGP12.phx.gbl... >I am creating an application and was wondering how you can define the >registry settings for the hooks automatically when the application is >loaded. > For example - increasing the hook count...

I'm Paste values stupid
I'm trying to do something very simple. I go to a sheet and select a range and click copy to copy a range. I switch to another workbook and click a button. The code attached to the button should paste values into the active sheet starting at cell "A3". It's ridiculous because this should be easy; I even recorded a macro to do this and the recording fails. Microsoft hasn't improved this yet????? Here is some of the code I've tried: ActiveSheet.Range("A3").PasteSpecial Paste:=xlPasteValues Cells.PasteSpecial Paste:=xlPasteValues ActiveSheet...

Is there a way to split a sheet so columns can be different widths?
I have a bunch of worksheets that have a top part and a bottom part. The top part contains settings for various parmeters. The bottom part is a table showing calculations based on those parameters. The problem is that the parameters often need different column widths than the table. Is there some way to split a sheet into a top part and a bottom part were I can adjust the column widths independently? Column widths and row heights are properties of the entire column and row and cannot be changed. I hesitate to mention "merged cells" due to the problems they can cause. ...

Setting up Exchange 2003 with my domain name
Hello. I have a server running Microsoft Windows Server 2003 with Exchange Server 2003 running also. I have a domain name that I would like to use with Exchange, but I don't know how to get Exchange to work with my domain and handle my e-mail. Could anyone please help? Thanks! Aaron Email addresses: These are generated by Recipient Policy. Let's call your domain name a "registered domain name" - it does need to be registered with a domain registrar for internet senders to be able to send you mail. 1. Is your AD using the registered domain? If yes, the default Recipi...

Windows 7 Update broke my code
I have been developing an app in VB6. My development machine is an XP Pro machine but I have a Windows 7 box that I use for testing. Everything has been working great.....until today. I use a text box that I have modified to automatically capitalize the 1st letter of each word. This ocx control is based off of a text box. On the Windows 7 box, it stopped working. Does anyone have any knowledge of a change that would affect the behaviour of a text box, or anything I can do to try to fix this? This is used all through my program. Thanks in advance. Kflash Sor...

Upgrading from 64-bit to 32-bit orVista and Win7 Update notificati
Hi, If I upgrade to 64-bit from 32-bit will the programs I have that are in 32-bit prompt me to update them also? Eg: WinRAR and Windows Media 9 Encoder have 32-bit and 64-bit versions. Would these programs tell me I can update to 64-bit if I search or automatically? What if I upgraded to Vista or Windows 7? I find that the automatic updates seem to want the updates in a case like a system change. I assume the lesser bit versions would work on a more powerful system. I just need to know what I have to keep track of to uninstall and/or reinstall. "Brian V" &l...

Glitch When Updating
My daughter's computer was recently doing an update. We were at the point where the computer was rebooting and had the screen "do not turn off your computer, updating......" etc. Unfortunately, our ISP went out at that time, and the computer was left in that limbo for over 24 hours. I finally just hit the power button to turn it off, and now when we turn it on it is in a continual loop of rebooting itself. I've tried putting in the Windows disk and it reads it okay, and will get so far to reinstall, but then it does the same thing and reboots itself. I don't...

Save password setting not retained in Outlook 2000 (Q290684)
I run Windows 2000 Pro with Office 2000. My problem is that Outlook 2000 won't remember my saved passwords for my IMAP and POP3 email accounts. I wish I could tell you which stupid software or crashed caused this problem. But I usually only use Outlook 2000 about twice per month for archiving email purposes. Normally I use AOL Communicator most of the time and occasionally Outlook Express v6. Both of them operate just fine. I'm taking a wild guess here, but if I had to pick something that may have caused it, I'd say first it was People...

EXCEL-Counting unique values.
Is there a way to count the number of uniques values in a range. For example, if a range contains the values: a,a,a,b,c,c,d,d,d Is there a way to count so I know there are 4 unique values? Lots of examples of this at www.cpearson.com Bernard "Frank Garbe" <Frank.Garbe@oit.state.nj.us> wrote in message news:0e9801c36bcf$2f463b40$a101280a@phx.gbl... > Is there a way to count the number of uniques values in a > range. For example, if a range contains the values: > a,a,a,b,c,c,d,d,d > > Is there a way to count so I know there are 4 unique > values? On Tue...

Default mail settings Question
Outlook 2000. MS-Word is my default mail editor and when I click for a new email it defaults to a size 10 font. I would like it larger but don't see where the setting is. When Word itself starts it defaults to 12. -- Thanks in advance... Bob In Outlook; Tools-> Options-> tab Mail Format-> button Fonts... -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Office 2003 CD slipstreamed with Service Pack 1 ----- "Bob Newman" <bobnewman@att.net> wrote in message news:7tBad.794$HG3.658@lakerea...

Cannot update Bills/Deposits
I received an error message stating that another process had completed updating a transaction when I tried to update a downloaded transaction. Since that time, I cannot update my scheduled bills. I can pay online and modify the current bill/deposit. I cannot modify the bills without attempting to pay. Additionally, the account that I was attempting to update has 1 transaction showing as downloaded in the account list. If I attempt to maintain the account, Money does nothing. I have repaired the file and nothin has changed. When additional transactions are downloaded for this a...

2007 Formula Needed to Update Table Values
I am using Excel 2007 and need help identifying a formula to complete a table with data from another range of cells. I can explain best through the following example: I want to fill in the missing data in the Table 1 with data from Table 2. Dog / Red needs to be updated with 111. Cat / Blue needs to be updated with 555. Monkey / Yellow needs to be updated with 888. Table #1 Dog Cat Monkey Red Blue Green Yellow Table #2 Dog Red 111 Dog Yellow 333 Cat Red 444 Cat Blue 555 Monkey Yellow 888 Monkey Blue 999 I have tried using Index, but Index uses R...

problem with macro setting
hi all, i have a problem every time i open file with existing macro there an error: "Because of your security settings, macros have been disabled. To run macros, you need to reopen this workbook, and then choose to enable macros" i use excel 2007. i already change my setting in Trust Center Settings and choose Enable all macros (not recommended,....) but still failed. If i create a new one than create new module, the macro will run but if i save and close then reopen, i can't run that file... what wrong with me? many thanks reza Review the below http://...

How do you get extras / the games (in settings) on the xbox to appear under extras??
Hi folks. I've got the Xbox 360. I've set up media center, which works fine. The tuner works fine (this is Windows 7). However, under settings on the Xbox (in media center), where it shows the games - (purble place etc), all are ticked, I click on save. BUT none of them appear under extras in media center (on the Xbox). But, they appear under extras (in Windows 7 media center). So, how do you get them to appear under extras? So, I can access them from the Xbox?? There's no point having the option to tick / untick the games on the Xbox, if none of them appear under...

Row and columns
In excel my rows are numbered 1 through XXX and my columns are also numbered 1 through XXX. On my other computers using the same current version of Excel the columns are identified using Alpha A,B,C,D etc. Anyone know how to change the columns to Alpha v.s. numbers? Joe, tools, optins, general, and uncheck R1C1 reference style -- Paul B Always backup your data before trying something new Using Excel 2000 & 97 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** "Joe" <anonymous@discussions.mic...

How to change Payee column width in Money?
Money 2002 Standard OEM does all I need, and though I have a couple of later versions around here I've seen no reason to upgrade. The one annoying thing is, when I download a QIF file from my bank, online bill payments show up in the Payee column like this: PEOPLE'S ONLINE BILL PAYMENT CON etc., always with only the first three characters of the payee's name, and since some of the payees' names have similar first three letters it is not as clear as it could be. Is there any way to increase the column width (number of characters)? I have loads of space in that column goin...

CRichEditCtrl and updates
Hi, I am using a CRichEditCtrl to display RTF files that have text and small bitmaps embedded (as simple help). There is one CRichEditCtrl per page in a wizard based propertypage application. I've configured the CRichEditCtrl with ES_READONLY. The problem I would like to solve is the flash in the CRichEditCtrl when switching pages. All my other controls I have fixed the flashing issue by exclduing their rect (ExcludeClipRect) from the update region when I erase the background. However, when I do that to this control, I only get new text written over old... Any ideas would be appreci...

Outlook Security Settings #4
Hey Ive been having some problems setting up Outlook Security Settings, to allow a macro in excel to send mails without promting if the users wants to allow an automated email to be sent. I started with installing the ORK and admpack.exe, then i followed the readme.doc step by step. - registered the hashctl.dll and comdlg.ocx - created a public folder "Outlook Security Settings" and gave myself owner role, the rest reviewer role. - opened outlooksecurity.oft in the new folder and published it there as well - opened a new form from the new published template, maed some changes and t...