Say i have a table Employee with the following columns : EmpID, Emp Name, Password, Emp Type.
Now when i remove the value EmpID, the gridview does not update. it just reloads when i hit update but no changes are made.
On the other hand say i make Emp Type as Read only, when i update .. the gridview updates, but the value of Emp Type updates as blank. While editing other values, the value of Emp Type that i made readonly shows correctly. But after i hit update and the values get sent to the DB in access, the field Emp Type updates as blank.
Is there any solution to this ? This is my code for the Employee update page:
CODE
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script language="VB" runat="server">
Protected Sub btlogout_Click(ByVal sender As Object, ByVal e As System.EventArgs)
FormsAuthentication.SignOut()
Response.Redirect("Default.aspx")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Origin TimeSheet :: Edit Details</title>
<link rel=stylesheet type="text/css" href="styles.css">
</head>
<body bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" topmargin="0" bgcolor="#EAEAEA">
<form id="form1" runat="server">
<center>
<table border="0" style="border: 2px solid #565656; border-top: 0px" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" height="100%" width="777">
<tr>
<td><!-- logo image --><img src="images/logo.jpg" border="0" width="232" height="106" alt=""><!-- end logo image --><img src="images/header.jpg" border="0" width="279" height="106" alt=""><img src="images/header1.jpg" border="0" width="267" height="106" alt=""></td>
</tr>
<tr>
<td background="images/menu_back.gif" style="height: 42px">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr><!-- menu starts here -->
<td width="16%" align="center"><a href="user_welcome.aspx" class="menu">Home</a></td>
<td><img src="images/menu_d.gif" border="0" width="2" height="29" alt=""></td>
<td width="16%" align="center"><a href="user_addtime.aspx" class="menu">Add TimeSheet </a></td>
<td><img src="images/menu_d.gif" border="0" width="2" height="29" alt=""></td>
<td width="16%" align="center"><a href="user_edittime.aspx" class="menu">Edit TimeSheet </a></td>
<td><img src="images/menu_d.gif" border="0" width="2" height="29" alt=""></td>
<td width="16%" align="center"><a href="" class="menu"><span style="color: greenyellow">Edit Details </span></a></td>
<td><img src="images/menu_d.gif" border="0" width="2" height="29" alt=""></td>
<td width="16%" align="center"></td>
<td></td>
<td width="16%" align="center"></td>
<td style="padding-right: 80px"></td>
<!-- menu ends here -->
</tr>
</table>
<asp:Button ID="Button1" runat="server" Font-Bold="True" ForeColor="Red" OnClick="btlogout_Click"
Text="Logout" /></td>
</tr>
<tr>
<td height="100%" valign="top" style="text-align: center">
<br />
<span style="font-size: 14pt">
<br />
<span style="font-size: 16pt; color: tomato; font-family: Trebuchet MS"><strong>Edit
your Details<br />
</strong></span> <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataKeyNames="UserID" DataSourceID="AccessDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="Type" HeaderText="Type" HtmlEncode="False" ReadOnly="True"
SortExpression="Type" />
<asp:BoundField DataField="UserID" HeaderText="UserID" ReadOnly="True" SortExpression="UserID" />
<asp:BoundField DataField="UserName" HeaderText="UserName" SortExpression="UserName" />
<asp:BoundField DataField="Password" HeaderText="Password" SortExpression="Password" />
<asp:BoundField DataField="RealName" HeaderText="RealName" SortExpression="RealName" />
<asp:CommandField ShowEditButton="True" />
</Fields>
</asp:DetailsView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" ConflictDetection="CompareAllValues"
DataFile="~/App_Data/origin_timesheet.mdb" DeleteCommand="DELETE FROM [Employee] WHERE [UserID] = ? AND [UserName] = ? AND [Password] = ? AND [RealName] = ? AND [Type] = ?"
InsertCommand="INSERT INTO [Employee] ([UserID], [UserName], [Password], [RealName], [Type]) VALUES (?, ?, ?, ?, ?)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [Employee] WHERE ([UserName] = ?)"
UpdateCommand="UPDATE [Employee] SET [UserName] = ?, [Password] = ?, [RealName] = ?, [Type] = ? WHERE [UserID] = ? AND [UserName] = ? AND [Password] = ? AND [RealName] = ? AND [Type] = ?">
<DeleteParameters>
<asp:Parameter Name="original_UserID" Type="Int32" />
<asp:Parameter Name="original_UserName" Type="String" />
<asp:Parameter Name="original_Password" Type="String" />
<asp:Parameter Name="original_RealName" Type="String" />
<asp:Parameter Name="original_Type" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="Password" Type="String" />
<asp:Parameter Name="RealName" Type="String" />
<asp:Parameter Name="Type" Type="String" />
<asp:Parameter Name="original_UserID" Type="Int32" />
<asp:Parameter Name="original_UserName" Type="String" />
<asp:Parameter Name="original_Password" Type="String" />
<asp:Parameter Name="original_RealName" Type="String" />
<asp:Parameter Name="original_Type" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:SessionParameter Name="UserName" SessionField="S2" Type="String" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="UserID" Type="Int32" />
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="Password" Type="String" />
<asp:Parameter Name="RealName" Type="String" />
<asp:Parameter Name="Type" Type="String" />
</InsertParameters>
</asp:AccessDataSource>
</span></td>
</tr>
<tr>
<td background="images/footer.gif" height="38">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" style="padding: 5px; color: #ffffff">All Rights Reserved 2007 :: Origin</td>
<td width="50%" style="padding: 5px" align="right">
</tr>
</table>
</td>
</tr>
</table>
</center>
<div>
<a href="user_welcome.aspx">Home</a><br />
<a href="user_addtime.aspx">Add</a><br />
<a href="user_edittime.aspx">Edit Time</a><br />
<a href="user_myedit.aspx">Edit Deatils</a></div>
<br />
<br />
<asp:Button ID="btlogout" runat="server" OnClick="btlogout_Click" Text="Logout" />
</form>
</body>
</html>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script language="VB" runat="server">
Protected Sub btlogout_Click(ByVal sender As Object, ByVal e As System.EventArgs)
FormsAuthentication.SignOut()
Response.Redirect("Default.aspx")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Origin TimeSheet :: Edit Details</title>
<link rel=stylesheet type="text/css" href="styles.css">
</head>
<body bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" topmargin="0" bgcolor="#EAEAEA">
<form id="form1" runat="server">
<center>
<table border="0" style="border: 2px solid #565656; border-top: 0px" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" height="100%" width="777">
<tr>
<td><!-- logo image --><img src="images/logo.jpg" border="0" width="232" height="106" alt=""><!-- end logo image --><img src="images/header.jpg" border="0" width="279" height="106" alt=""><img src="images/header1.jpg" border="0" width="267" height="106" alt=""></td>
</tr>
<tr>
<td background="images/menu_back.gif" style="height: 42px">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr><!-- menu starts here -->
<td width="16%" align="center"><a href="user_welcome.aspx" class="menu">Home</a></td>
<td><img src="images/menu_d.gif" border="0" width="2" height="29" alt=""></td>
<td width="16%" align="center"><a href="user_addtime.aspx" class="menu">Add TimeSheet </a></td>
<td><img src="images/menu_d.gif" border="0" width="2" height="29" alt=""></td>
<td width="16%" align="center"><a href="user_edittime.aspx" class="menu">Edit TimeSheet </a></td>
<td><img src="images/menu_d.gif" border="0" width="2" height="29" alt=""></td>
<td width="16%" align="center"><a href="" class="menu"><span style="color: greenyellow">Edit Details </span></a></td>
<td><img src="images/menu_d.gif" border="0" width="2" height="29" alt=""></td>
<td width="16%" align="center"></td>
<td></td>
<td width="16%" align="center"></td>
<td style="padding-right: 80px"></td>
<!-- menu ends here -->
</tr>
</table>
<asp:Button ID="Button1" runat="server" Font-Bold="True" ForeColor="Red" OnClick="btlogout_Click"
Text="Logout" /></td>
</tr>
<tr>
<td height="100%" valign="top" style="text-align: center">
<br />
<span style="font-size: 14pt">
<br />
<span style="font-size: 16pt; color: tomato; font-family: Trebuchet MS"><strong>Edit
your Details<br />
</strong></span> <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataKeyNames="UserID" DataSourceID="AccessDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="Type" HeaderText="Type" HtmlEncode="False" ReadOnly="True"
SortExpression="Type" />
<asp:BoundField DataField="UserID" HeaderText="UserID" ReadOnly="True" SortExpression="UserID" />
<asp:BoundField DataField="UserName" HeaderText="UserName" SortExpression="UserName" />
<asp:BoundField DataField="Password" HeaderText="Password" SortExpression="Password" />
<asp:BoundField DataField="RealName" HeaderText="RealName" SortExpression="RealName" />
<asp:CommandField ShowEditButton="True" />
</Fields>
</asp:DetailsView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" ConflictDetection="CompareAllValues"
DataFile="~/App_Data/origin_timesheet.mdb" DeleteCommand="DELETE FROM [Employee] WHERE [UserID] = ? AND [UserName] = ? AND [Password] = ? AND [RealName] = ? AND [Type] = ?"
InsertCommand="INSERT INTO [Employee] ([UserID], [UserName], [Password], [RealName], [Type]) VALUES (?, ?, ?, ?, ?)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [Employee] WHERE ([UserName] = ?)"
UpdateCommand="UPDATE [Employee] SET [UserName] = ?, [Password] = ?, [RealName] = ?, [Type] = ? WHERE [UserID] = ? AND [UserName] = ? AND [Password] = ? AND [RealName] = ? AND [Type] = ?">
<DeleteParameters>
<asp:Parameter Name="original_UserID" Type="Int32" />
<asp:Parameter Name="original_UserName" Type="String" />
<asp:Parameter Name="original_Password" Type="String" />
<asp:Parameter Name="original_RealName" Type="String" />
<asp:Parameter Name="original_Type" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="Password" Type="String" />
<asp:Parameter Name="RealName" Type="String" />
<asp:Parameter Name="Type" Type="String" />
<asp:Parameter Name="original_UserID" Type="Int32" />
<asp:Parameter Name="original_UserName" Type="String" />
<asp:Parameter Name="original_Password" Type="String" />
<asp:Parameter Name="original_RealName" Type="String" />
<asp:Parameter Name="original_Type" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:SessionParameter Name="UserName" SessionField="S2" Type="String" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="UserID" Type="Int32" />
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="Password" Type="String" />
<asp:Parameter Name="RealName" Type="String" />
<asp:Parameter Name="Type" Type="String" />
</InsertParameters>
</asp:AccessDataSource>
</span></td>
</tr>
<tr>
<td background="images/footer.gif" height="38">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" style="padding: 5px; color: #ffffff">All Rights Reserved 2007 :: Origin</td>
<td width="50%" style="padding: 5px" align="right">
</tr>
</table>
</td>
</tr>
</table>
</center>
<div>
<a href="user_welcome.aspx">Home</a><br />
<a href="user_addtime.aspx">Add</a><br />
<a href="user_edittime.aspx">Edit Time</a><br />
<a href="user_myedit.aspx">Edit Deatils</a></div>
<br />
<br />
<asp:Button ID="btlogout" runat="server" OnClick="btlogout_Click" Text="Logout" />
</form>
</body>
</html>
Really Really need help in this guys,
Thanks and regards in advance.
Dhanesh.

