You provided source code, but, didn't provide your database backup. So, couldn't try to debug the codes in Visual Studio.
However, are you trying to update data using the
btnSave_Click()
? If that is so, instead of using the following code to update data:
<asp:Button enabled="true" ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" CommandName="Update" />
protected void btnSave_Click(object sender, EventArgs e)
{
Envelope.DataBind();
}
You should try to remove the
OnClick="btnSave_Click"
event handler and see what happens:
<asp:Button enabled="true" ID="btnSave" runat="server" Text="Save" CommandName="Update" />
Because, using the
"CommandName"
property of the
Button
, the Asp.net runtime binds the Button's update command with the Update command of the
SqlDataSource
and executes the Update Query.
But, if you really want to use the
btnSaveClick()
method , you should write your own codes to update data (Like the following you've already written):
protected void calArticles_SelectionChanged(object sender, EventArgs e)
{
SqlDataSource1.SelectCommand =
System.String.Concat("SELECT [Timestamp], [Subject], [EntryText] FROM [Article] WHERE [Timestamp] >= '" +
calArticles.SelectedDate.ToString() + "' AND [Timestamp] < (DATEADD(day, 1, [Timestamp]));");
Envelope.DataBind();
}
I can suggest you the following link to see how to update data using FormView and SqlDataSource:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.formview.aspx[
^]