Question : How do I embed ajax calendar extender in asp.net gridview correctly?

Hi experts..
Using VS2010 (VB.Net)
I have a gridview with itemTemplate and editItemTemplate configured.
In the EditItemTemplate I have a ajax Calendar extendar, so that when the row is in edit mode and the user wants to edit a certainfield (Date field), the calendar will show.

This works EXCEPT that...
I click in the field and the calendar launches BUT the page then does a postback immediately and the calendar disappears.

Any ideas chappies??

Code follows...



Thanks in anticipation
Looking forward to some help..
Thanks...

Dave
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
<%@ Page Title="" Language="VB"  EnableEventValidation="false" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="zzzTestForm.aspx.vb" Inherits="zzzTestForm" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </cc1:ToolkitScriptManager>
    <%--<asp:GridView ID="gvLeaveAppManage" runat="server" BackColor="White" BorderColor="White"
        BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" GridLines="None"
        AllowPaging="True" 
        DataSourceID="SqlDataSource1">--%>
    <asp:GridView ID="gvLeaveAppManage" runat="server" BackColor="White" BorderColor="White"
        BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" GridLines="None"
        AllowPaging="True" DataSourceID="SqlDataSource1" 
        AutoGenerateEditButton="True" AutoGenerateColumns="False">
        <Columns>
            <asp:TemplateField AccessibleHeaderText="ID" HeaderText="ID">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Ref") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("Ref") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField AccessibleHeaderText="Name" HeaderText="Name">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField AccessibleHeaderText="Start" HeaderText="Start">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Start") %>'></asp:TextBox>
                    <cc1:calendarextender id="tbLeaveAppFirstDay_CalendarExtender" runat="server"
                        enabled="True" format="dd/MM/yyyy" targetcontrolid="TextBox3" EnableViewState="True">
                    </cc1:calendarextender>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("Start") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField AccessibleHeaderText="End" HeaderText="End">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("End") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("End") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField AccessibleHeaderText="Days" HeaderText="Days">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Days") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("Days") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField AccessibleHeaderText="Type" HeaderText="Type">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("Type") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" Text='<%# Bind("Type") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
        <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
        <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
        <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F1F1F1" />
        <SortedAscendingHeaderStyle BackColor="#594B9C" />
        <SortedDescendingCellStyle BackColor="#CAC9C9" />
        <SortedDescendingHeaderStyle BackColor="#33276A" />
     </asp:GridView>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:leaveConnectionString %>"
        ProviderName="<%$ ConnectionStrings:leaveConnectionString.ProviderName %>" 
        SelectCommand="SELECT lid as 'Ref', lname as 'Name', DATE_FORMAT(lstart, '%d %b %y') as 'Start', DATE_FORMAT(lend, '%d %b %y') as 'End', ldays as 'Days', ltype as 'Type' FROM leave.applications WHERE lstatus = 'Approved' AND lend >= curdate();"
        UpdateCommand="UPDATE leave.applications SET lstart = @Start, lend = @End, ldays = @Days, ltype = @Type WHERE lid = @Ref">
        <UpdateParameters>
            <asp:Parameter Type="DateTime"
                Name="Start" />
            <asp:Parameter Type="DateTime"
                Name="End" />
            <asp:Parameter Type="Double"
                Name="Days" />
            <asp:Parameter Type="String"
                Name="Type" />
            <asp:Parameter Type="String"
                Name="Ref" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder4" Runat="Server">
</asp:Content>

Answer : How do I embed ajax calendar extender in asp.net gridview correctly?

Random Solutions  
 
programming4us programming4us