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