hello,
This is my .aspx code.
I am not able to update the checkbox value while clicking update button.
Please help.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShowMovies.aspx.cs" Inherits="ShowMovies" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataSourceID="srcMovies" DataKeyNames ="ID" Width="544px"
AutoGenerateEditButton ="true" Height="224px" >
<Columns>
<asp:BoundField DataField ="Id" ReadOnly ="True" HeaderText ="Id" SortExpression ="Id" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="Director" HeaderText="Director" SortExpression="Director" />
<asp:TemplateField HeaderText="InTheatres">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Convert.ToBoolean(Eval("InTheatres").ToString().Equals("Y")) %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Convert.ToBoolean(Bind("InTheatres").ToString().Equals("Y")) %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="DateReleased" HeaderText="DateReleased" SortExpression="DateReleased" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="srcMovies" runat="server" ConnectionString="Data Source=COMPAQ\SQLEXPRESS;Initial Catalog=Movies;Integrated Security=True"
SelectCommand="SELECT * FROM [movies]"
UpdateCommand ="UPDATE movies SET Id = @ID, Title = @title,
Director = @director,InTheatres= @intheatres,DateReleased=@date
WHERE (Id = @ID)" ProviderName="System.Data.SqlClient"></asp:SqlDataSource>
</div>
</form>
</body>
</html>