Dear friends,
I have a tab container with many tab panels in it. In each tab panel, I have a GridView which has an Edit button in each row. When Edit button is pressed, it turns into an Update button, and all fields become editable. When the Update button is pressed, the values are saved in the database.
I have 2 problems:
1) On pressing the Edit button, sometimes nothing happens, sometimes it works properly.
I noticed that Edit always works if I first refresh the page.
When the Edit button works on one tab panel, and I change tab, on another tab panel it doesn't work, the Edit button handler is not called, and when I press Edit, the TabChanged handler is called instead.
2) On pressing Update button, DBInterfaceGridView_RowUpdating() is not executed, thus nothing is saved.
<ajaxToolkit:TabContainer ID="tcDBInterface" runat="server"
ActiveTabIndex="16" OnClientActiveTabChanged="clientActiveTabChanged"
Width="5100" style="margin-right: 53px"
onactivetabchanged="tcDBInterface_ActiveTabChanged" >
<ajaxToolkit:TabPanel runat="server" HeaderText="AuthourLinks" ID="AuthorLinksTabPanel" >
<HeaderTemplate>
AuthourLinks
</HeaderTemplate>
<ContentTemplate>
<asp:UpdatePanel ID="upnlAuthorLinks" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:ValidationSummary ID="AuthorLinksValidationSummary" runat="server"
BorderStyle="Solid" HeaderText="The following error(s) occured:" />
<asp:GridView ID="AuthorLinksGridView" runat="server" AllowSorting="True" ShowFooter="True"
AllowPaging="True" PageSize="15" DataSourceID="AuthorLinksSqlDataSource"
OnRowDataBound="DBInterfaceGridView_RowDataBound" AutoGenerateColumns="False"
OnRowUpdating="DBInterfaceGridView_RowUpdating"
OnRowDeleting="DBInterfaceGridView_RowDeleting"
Width="800px" Height="306px" DataKeyNames="ID"
CssClass="largegridview" Visible="False"
onrowediting="DBInterfaceGridView_RowEditing" >
<AlternatingRowStyle CssClass="alternatingrowstyle" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="btnEdit" runat="server" Text="Edit" CommandName="Edit" ImageUrl="~/Images/Edit.gif" ToolTip="Edit" CausesValidation="False"></asp:ImageButton>
<asp:ImageButton ID="btnDelete" runat="server" Text="Delete" CommandName="Delete" ImageUrl="~/Images/Delete.gif" ToolTip="Delete" CausesValidation="False" OnClientClick = "return confirm('Are you sure you want to delete this record?')"></asp:ImageButton>
</ItemTemplate>
<EditItemTemplate>
<asp:ImageButton ID="btnUpdate" runat="server" Text="Update" CommandName="Update" ImageUrl="~/Images/Update.gif" ToolTip="Update" OnClientClick = "return confirm('Are you sure you want to update this record?')"></asp:ImageButton>
<asp:ImageButton ID="btnCancel" runat="server" Text="Cancel" CommandName="Cancel" ImageUrl="~/Images/Cancel.gif" ToolTip="Cancel" CausesValidation="False"></asp:ImageButton>
</EditItemTemplate>
<FooterTemplate>
<asp:ImageButton ID="btnAddNew" runat="server" CommandName="AddNew" Text="Add New Record" ImageUrl="~/Images/Insert.gif" ToolTip="Add New Record" CausesValidation="False" OnClick="DBInterfaceGridView_AddNew"></asp:ImageButton>
<asp:ImageButton ID="btnSaveNew" runat="server" CommandName="SaveNew" Text="Save New Record" ImageUrl="~/Images/Update.gif" ToolTip="Save New Record" Visible="false" OnClick="DBInterfaceGridView_Insert"></asp:ImageButton>
<asp:ImageButton ID="btnCancelNew" runat="server" CommandName="Cancel" Text="Cancel" ImageUrl="~/Images/Cancel.gif" ToolTip="Cancel" CausesValidation="False" Visible="false" ></asp:ImageButton>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BookStem" SortExpression="BookStem">
<EditItemTemplate>
<asp:DropDownList ID="BookStem" runat="server" SelectedValue='<%# Eval("BookStem") %>'
DataSourceID="BookListObjectDataSource" DataTextField="BookStem" DataValueField="BookStem">
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblBookStem" runat="server" Text='<%#Bind("BookStem") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="newBookStem" runat="server" Visible="false"
DataSourceID="BookListObjectDataSource" DataTextField="BookStem" DataValueField="BookStem" >
</asp:DropDownList>
</FooterTemplate>
... many other fields
Thanks,
Dmitriy