Wrox Programmer Forums
|
BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9
This is the forum to discuss the Wrox book Professional ASP.NET 3.5: In C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470187579
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 15th, 2009, 10:10 AM
Registered User
 
Join Date: Nov 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Need to Log When Edit Occurs in Gridview

I've created a gridview as discussed in Chapter 7, and made it editable as discussed on pages 321 & 322.

My gridview displays the information that was entered from a form plus a time stamp and the submitter's user ID.

In the event information is edited on a specific row, I need to overwrite the time stamp, and requestor on that row to show who edited the entry.

Since I'm already logging the initial entries I understand how to handle that portion.I'm just not sure of the event type that occurs and how to single out the specific row's edit button that was used. I'm using VB.Net on my code behind page, and SQL for the database.

Below is my code. Thanks in advance!!

Code:
 
<divclass="gridview-container"><asp:GridViewID="GridView1"DataSourceID="SqlDataSource1"runat="server"DataKeyNames="Sequence"
wrap="false"ForeColor="Black"ShowFooter="True"CellPadding="5"BackColor="White"BorderWidth="1px"BorderStyle="None"BorderColor="#CCCCCC"Height="135px"AllowPaging="True"AllowSorting="True"AutoGenerateEditButton="True"AutoGenerateColumns="False">
<Columns>
<asp:BoundFieldDataField="Sequence"HeaderText="Sequence"SortExpression="Sequence"InsertVisible="False"ReadOnly="True"/>
<asp:BoundFieldDataField="DeptID"HeaderText="Dept ID"SortExpression="DeptID"/>
<asp:BoundFieldDataField="Dept"HeaderText="Dept"SortExpression="Dept"/>
<asp:BoundFieldDataField="DeptOU"HeaderText="Dept OU"SortExpression="DeptOU"/>
<asp:BoundFieldDataField="InstOU"HeaderText="Institution OU"SortExpression="InstOU"/>
<asp:BoundFieldDataField="HomeDir"HeaderText="Home Directory"SortExpression="HomeDir"/>
<asp:BoundFieldDataField="Groups"HeaderText="Groups"SortExpression="Groups"/>
<asp:BoundFieldDataField="Contact"HeaderText="Contact"SortExpression="Contact"/>
<asp:BoundFieldDataField="Phone"HeaderText="Phone"SortExpression="Phone"/>
<asp:BoundFieldDataField="Email"HeaderText="Email"SortExpression="Email"/>
<asp:BoundFieldDataField="ZoneMgr"HeaderText="Zone Manager"SortExpression="ZoneMgr"/>
<asp:BoundFieldDataField="Submitted"HeaderText="Submitted"SortExpression="Submitted"/>
<asp:BoundFieldDataField="Requestor"HeaderText="Requestor"SortExpression="Requestor"/>
</Columns>
<HeaderStyleFont-Bold="true"Wrap="false"ForeColor="White"BackColor="#333333"/><FooterStyleFont-Bold="true"Wrap="false"ForeColor="White"BackColor="#333333"/><AlternatingRowStyleFont-Bold="True"Wrap="False"ForeColor="black"BackColor="#CCCC99"></AlternatingRowStyle>
</asp:GridView>
<asp:SqlDataSourceID="SqlDataSource1"runat="server"
SelectCommand="SELECT * FROM [Automated_ZM_Dept_Request]"
ConnectionString="<%$ ConnectionStrings:MyConnection2 %>"DataSourceMode="DataSet"
UpdateCommand="UPDATE [Automated_ZM_Dept_Request] SET [DeptID] = @DeptID, [Dept] = @Dept, [DeptOU] = @DeptOU, [InstOU] = @InstOU, [HomeDir] = @HomeDir, [Groups] = @Groups, [Contact] = @Contact, [Phone] = @Phone, [email] = @Email, [ZoneMgr] = @ZoneMgr, [Submitted] = @Submitted, [Requestor] = @Requestor WHERE [Sequence] = @Sequence">
<UpdateParameters>
<asp:ParameterType="String"Name="Sequence"></asp:Parameter><asp:ParameterType="String"Name="DeptID"></asp:Parameter>
<asp:ParameterType="String"Name="Dept"></asp:Parameter>
<asp:ParameterType="String"Name="DeptOU"></asp:Parameter>
<asp:ParameterType="String"Name="InstOU"></asp:Parameter>
<asp:ParameterType="String"Name="HomeDir"></asp:Parameter>
<asp:ParameterType="String"Name="Groups"></asp:Parameter>
<asp:ParameterType="String"Name="Contact"></asp:Parameter>
<asp:ParameterType="String"Name="Phone"></asp:Parameter>
<asp:ParameterType="String"Name="Email"></asp:Parameter>
<asp:ParameterType="String"Name="ZoneMgr"></asp:Parameter>
<asp:ParameterType="String"Name="Submitted"></asp:Parameter>
<asp:ParameterType="String"Name="Requestor"></asp:Parameter>
</UpdateParameters>
</asp:SqlDataSource></div><!-- end gridview-container -->





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Gridview to Edit NOT DetailsView ? kalel_4444 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 December 4th, 2008 11:36 PM
Can not Edit gridview having TemplateField coolcoder2007 .NET Framework 2.0 4 March 6th, 2008 06:36 AM
edit item in gridview al-hijjawi Visual Studio 2005 0 December 27th, 2006 03:20 PM
edit gridview anurag_ur ASP.NET 2.0 Basics 3 June 21st, 2006 03:21 AM
edit gridview anurag_ur ASP.NET 2.0 Basics 0 June 20th, 2006 07:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.