Hi phonghue,
I have created an example.
Check this example and its reference to modify your code.
Database
CREATE TABLE STUDENTSPLACEMENTS
(
AutoNum INT IDENTITY PRIMARY KEY,
StudCWID INT,
TermID INT,
STUDFirstname VARCHAR(50),
STUDLastname VARCHAR(50),
ContactDate DATETIME
)
INSERT INTO STUDENTSPLACEMENTS VALUES(1,1,'Test1 First','Test1 Last',GETDATE())
INSERT INTO STUDENTSPLACEMENTS VALUES(2,2,'Test2 First','Test2 Last',GETDATE())
INSERT INTO STUDENTSPLACEMENTS VALUES(3,1,'Test3 First','Test3 Last',GETDATE())
INSERT INTO STUDENTSPLACEMENTS VALUES(4,2,'Test4 First','Test4 Last',GETDATE())
SELECT * FROM STUDENTSPLACEMENTS
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function () {
$("[id*=GridView1]").find(":text").each(function () {
var title = $(this).attr("title");
if (title == "Contact Date") {
$(this).datepicker({
dateFormat: 'dd-mm-yy'
});
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource3" DataKeyNames="AutoNum">
<AlternatingRowStyle BackColor="#CCCCFF" />
<Columns>
<asp:BoundField DataField="AutoNum" HeaderText="AutoNum" SortExpression="AutoNum" InsertVisible="False" ReadOnly="True" Visible="false" />
<asp:BoundField DataField="StudCWID" HeaderText="CWID" SortExpression="StudCWID" ReadOnly="True" />
<asp:BoundField DataField="STUDLastname" HeaderText="STUDLastname" SortExpression="STUDLastname" Visible="false" />
<asp:BoundField DataField="STUDFirstname" HeaderText="STUDFirstname" SortExpression="STUDFirstname" Visible="false" />
<asp:BoundField DataField="ContactDate" HeaderText="Contact Date" SortExpression="ContactDate" DataFormatString="{0:dd-MM-yyyy}" />
<asp:CommandField ShowEditButton="True" ButtonType="Button" />
<asp:CommandField ShowDeleteButton="True" ButtonType="Button" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:DBHUSRConnectionString %>"
SelectCommand="SELECT * FROM STUDENTSPLACEMENTS" SelectCommandType="Text"
UpdateCommand="UPDATE STUDENTSPLACEMENTS SET ContactDate = @ContactDate WHERE (AutoNum = @AutoNum)"
DeleteCommand="DELETE FROM STUDENTSPLACEMENTS WHERE (AutoNum = @AutoNum)">
<DeleteParameters>
<asp:Parameter Name="AutoNum" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ContactDate" Type="DateTime" />
<asp:Parameter Name="AutoNum" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
Screenshot
Database record after update