Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have some critical problem with edit item template of gridview.

My aspx code for the girdview is like

XML
<asp:TemplateField HeaderText="T1" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <%-- <asp:Label ID="lblMonth1" Text='<%#Eval("Percentage1") %>' runat="server"></asp:Label>--%>
                        <asp:LinkButton ID="lblMonth1" Text='<%#Eval("Percentage1") %>' runat="server" OnClick="lblMonth_Click"></asp:LinkButton>
                        <asp:HiddenField ID="PeriodID1" runat="server" Value='<%#Eval("PeriodID1") %>' />
                        <asp:Label ID="date1" runat="server" Text='<%#Eval("date1","{0:d}") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox Width="70px" EnableCalendar="true" EnableShortDateCalendarString="true"
                            ID="datemonth1" CssClass="setting" runat="server" Text='<%#Eval("date1","{0:d}") %>'></asp:TextBox>
                        <ajaxToolkit:CalendarExtender ID="cal1" BehaviorID="bcal1" Enabled="true" PopupPosition="BottomRight"
                            TargetControlID="datemonth1" Format="dd/MM/yyyy" CssClass="font_strike" runat="server">
                        </ajaxToolkit:CalendarExtender>
                    </EditItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="50px"></ItemStyle>
                </asp:TemplateField>                              
                <asp:CommandField ShowDeleteButton="false" ShowEditButton="true" DeleteText="Verwijder"
                    ItemStyle-BorderColor="Black" ItemStyle-ForeColor="Blue" EditText="Bewerk" CancelText="Annuleer"
                    UpdateText="Update"></asp:CommandField>
            </Columns>


I have made 10 cloumns same as the one datemonth1 in the table.
So i have 10 edit item templates in my page and I have set the calender control and all settings in gridview rowdata bound event..

If anyone need the code i can paste it here..

The flow in my page is


1)in the mainscreenpanel it shows a table based on the selection in the dropdowns
2)in the main screen panel i am providing a link button which shows second scrin in which i am showing the above gridview
3)now the problem is on clicking the edit link in the above table it works as i want but when I am not clicking on cancel link or update link,and directly press back button it shows main screen
4)and then again if i am clicking on the link button it shows the tables edititems.

How can i solve it..?
can any one help me..?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900