A
Andy B
I have a GridView with a LINQDataSource attached to it. My code in the aspx
markup is below. I need to know why only the checkbox field for the
activated column is getting updated (the EditTemplate). None of the other
columns get updated except for that one. Any ideas? The only column that is
not able to be updated is the ID column, but that isn't even in the table.
<asp:GridView ID="EternityNewsMemberList" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataSourceID="EternityNewsMemberListDataSource"
EmptyDataText="There are no members yet." HorizontalAlign="Center"
ShowFooter="True" DataKeyNames="ID">
<Columns>
<asp:TemplateField HeaderText="Name" SortExpression="Name">
<FooterTemplate>
<asp:Label ID="Label3" runat="server" Text="Name"></asp:Label>
<asp:TextBox ID="Insert_NewsletterSubscriberNameTextBox"
runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="Edit_NewsletterSubscriberNameTextBox" runat="server"
Text='<%# Eval("Name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Name")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Email Address" SortExpression="EmailAddress">
<FooterTemplate>
<asp:Label ID="Label4" runat="server" Text="Email
address"></asp:Label>
<asp:TextBox ID="Insert_NewsLetterSubscriberEmailAddressTextBox"
runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="Edit_NewsletterSubscriberEmailAddressTextBox"
runat="server" Text='<%# Eval("EmailAddress") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("EmailAddress")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Activated" SortExpression="Activated">
<FooterTemplate>
<asp:Label ID="Label5" runat="server" Text="Activated, automatically set to
yes."></asp:Label>
</FooterTemplate>
<EditItemTemplate>
<asp:CheckBox ID="Edit_NewsletterSubscriberActivatedCheckBox" runat="server"
Checked='<%# Bind("Activated") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Activated")
%>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<FooterTemplate>
<asp:LinkButton ID="EternityNewsInsertLinkButton" runat="server"
Text="Insert" />
</FooterTemplate>
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True"
CommandName="Update" Text="Update"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
CommandName="Edit" Text="Edit"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server"
CausesValidation="False" CommandName="Delete"
Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:LinqDataSource ID="EternityNewsMemberListDataSource" runat="server"
ContextTypeName="Main.DataSources.MailingListsDataContext"
TableName="EternityNews" EnableDelete="True" EnableUpdate="True">
</asp:LinqDataSource>
markup is below. I need to know why only the checkbox field for the
activated column is getting updated (the EditTemplate). None of the other
columns get updated except for that one. Any ideas? The only column that is
not able to be updated is the ID column, but that isn't even in the table.
<asp:GridView ID="EternityNewsMemberList" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataSourceID="EternityNewsMemberListDataSource"
EmptyDataText="There are no members yet." HorizontalAlign="Center"
ShowFooter="True" DataKeyNames="ID">
<Columns>
<asp:TemplateField HeaderText="Name" SortExpression="Name">
<FooterTemplate>
<asp:Label ID="Label3" runat="server" Text="Name"></asp:Label>
<asp:TextBox ID="Insert_NewsletterSubscriberNameTextBox"
runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="Edit_NewsletterSubscriberNameTextBox" runat="server"
Text='<%# Eval("Name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Name")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Email Address" SortExpression="EmailAddress">
<FooterTemplate>
<asp:Label ID="Label4" runat="server" Text="Email
address"></asp:Label>
<asp:TextBox ID="Insert_NewsLetterSubscriberEmailAddressTextBox"
runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="Edit_NewsletterSubscriberEmailAddressTextBox"
runat="server" Text='<%# Eval("EmailAddress") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("EmailAddress")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Activated" SortExpression="Activated">
<FooterTemplate>
<asp:Label ID="Label5" runat="server" Text="Activated, automatically set to
yes."></asp:Label>
</FooterTemplate>
<EditItemTemplate>
<asp:CheckBox ID="Edit_NewsletterSubscriberActivatedCheckBox" runat="server"
Checked='<%# Bind("Activated") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Activated")
%>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<FooterTemplate>
<asp:LinkButton ID="EternityNewsInsertLinkButton" runat="server"
Text="Insert" />
</FooterTemplate>
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True"
CommandName="Update" Text="Update"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
CommandName="Edit" Text="Edit"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server"
CausesValidation="False" CommandName="Delete"
Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:LinqDataSource ID="EternityNewsMemberListDataSource" runat="server"
ContextTypeName="Main.DataSources.MailingListsDataContext"
TableName="EternityNews" EnableDelete="True" EnableUpdate="True">
</asp:LinqDataSource>