When I click on the auto-generated Update button, absolutely nothing happens. Can you see anything wrong with my code below?
Should there be more code somewhere else to make the update happen?
<asp:DetailsView ID="DetailsView1"
runat="server"
AutoGenerateRows="False"
DataKeyNames="student_id" DataSourceID="SqlDataSource1"
ForeColor="Blue"
BackColor="#FFF7E6"
AutoPostBack="True"
AutoGenerateEditButton = True
AutoGenerateInsertButton = True
OnModeChanging="StudentDetailView_ModeChanging"
Height=163px
Width=327px
style="left: 400px; top: 1px; position: absolute;">
<Fields>
<asp:TemplateField
HeaderText="Username">
<EditItemTemplate>
<asp:TextBox
id="txtUserName"
Text = '<%# Bind ("username") %>'
runat = "server" />
<asp:RequiredFieldValidator
ID = "reqUserName"
ControlToValidate = "txtUserName"
Text = "(required)"
Display = "Dynamic"
runat = "server" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label
id="UsernameLabel"
runat="server"
Text = '<%# Eval("username") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField
HeaderText="Password">
<EditItemTemplate>
<asp:TextBox
id="txtPassword"
Text = '<%# Bind ("password") %>'
runat = "server" />
<asp:RequiredFieldValidator
ID = "reqPassword"
ControlToValidate = "txtPassword"
Text = "(required)"
Display = "Dynamic"
runat = "server" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label
id="PasswordLabel"
runat="server"
Text = '<%# Eval("password") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField
HeaderText="Date of birth">
<EditItemTemplate>
<asp:TextBox
id="txtDOB"
Text = '<%# Bind("dateofbirth") %>'
runat = "server" />
<asp:RangeValidator
runat="server" id="rngDOB"
controltovalidate="txtDOB"
type="Date"
minimumvalue="01-01-1930"
maximumvalue="01-01-2007"
errormessage="Please enter a valid date."
HtmlEncode="false" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label
id="DOBLabel"
runat="server"
DataFormatString="{0:dd/MM/yyyy}"
HtmlEncode="false"
/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField
HeaderText="Start date">
<EditItemTemplate>
<asp:TextBox
id="txtStartDate"
Text = '<%# Bind("startdate") %>'
runat = "server" />
<asp:RangeValidator
runat="server" id="rngStartDate"
controltovalidate="txtStartDate"
type="Date"
minimumvalue="01-01-1930"
maximumvalue="01-01-2050"
errormessage="Please enter a valid date."
HtmlEncode="false" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label
id="StartDateLabel"
runat="server"
DataFormatString="{0:dd/MM/yyyy}"
HtmlEncode="false"
/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField
datafield="maths"
headertext="Maths"
SortExpression="maths"
/>
<asp:BoundField ApplyFormatInEditMode="True" DataFormatString="<%=date()%>" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:FCLManager %>" ProviderName="MySql.Data.MySqlClient"
SelectCommand="SELECT * from tblstudentinfo WHERE centre_id = @CentreID and fullname = @FullName"
UpdateCommand="UPDATE [tblstudentinfo] SET [username] = @username, [password] = @password etc. etc. WHERE [centre_id] = @CentreID and [fullname] = @FullName">
<UpdateParameters>
<asp:Parameter Name="student_id" Type="Int32" />
<asp:Parameter Name="centre_id" Type="Int16" />
<asp:Parameter Name="username" Type="String" />
<asp:Parameter Name="password" Type="String" />
<asp:Parameter Name="fullname" Type="String" />
<asp:Parameter Name="firstname" Type="String" />
<asp:Parameter Name="surname" Type="String" />
<asp:Parameter Name="dateofbirth" Type="DateTime" />
<asp:Parameter Name="classday1" Type="String" />
<asp:Parameter Name="classday2" Type="String" />
<asp:Parameter Name="startdate" Type="DateTime" />
<asp:Parameter Name="currentstudent" Type="String" />
<asp:Parameter Name="maths" Type="String" />
<asp:Parameter Name="english" Type="String" />
<asp:Parameter Name="gender" Type="String" />
<asp:Parameter Name="address1" Type="String" />
<asp:Parameter Name="address2" Type="String" />
<asp:Parameter Name="address3" Type="String" />
<asp:Parameter Name="address4" Type="String" />
<asp:Parameter Name="telephonenumber" Type="String" />
<asp:Parameter Name="postcode" Type="String" />
<asp:Parameter Name="emailaddress" Type="String" />
<asp:Parameter Name="mathsnotes" Type="String" />
<asp:Parameter Name="englishnotes" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:Parameter Name="CentreID" Type="Int16" DefaultValue="0" />
<asp:Parameter Name="FullName" Type="String" DefaultValue="0" />
</SelectParameters>
</asp:SqlDataSource>
Please note that some of the fields have been omitted here in the interests of shortness!