1

Currently in my visual WebPart Contains update panel , but it not working, it post back the whole page

my code My .aspx code

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<ContentTemplate>
    <div>
        <div class="leftSection">
            <asp:DropDownList ID="ddlYear" runat="server" AutoPostBack="True">
                <asp:ListItem Text="2015" Value="2015"></asp:ListItem>
                <asp:ListItem Text="2016" Value="2016"></asp:ListItem>
            </asp:DropDownList>
    <div class="frmDate"><p>From</p>
        <SharePoint:DateTimeControl ID="from" runat="server" DateOnly="True" AutoPostBack="true" MaxDate="8900-12-31" MinDate="2015-07-31"  OnDateChanged="from_DateChanged" Calendar="1" IsRequiredField="true"  ErrorMessage="Please Select From Date"/>
    </div>
        <div class="lastDate">
            <p>
                To
            </p>
            <SharePoint:DateTimeControl ID="to" runat="server" DateOnly="True" OnDateChanged="to_DateChanged" AutoPostBack="true"  OnValueChangeClientScript="holidayDates()" IsRequiredField="true" ErrorMessage="Plaese Select To Date" />

        </div>
            </div>
        <div class="rightSection">
        <div  id="testdiv" runat="server">

        </div>
            <asp:Label CssClass="hdn-lbl lblFromDate" ID="lblFromDate" runat="server" Text="Label"></asp:Label>
            <asp:Label CssClass="hdn-lbl lblToDate" ID="lblToDate" runat="server" Text="Label"></asp:Label>
            <asp:Label CssClass="hdn-lbl lblTotalHrs" ID="lblTotalHrs" runat="server" Text="Label"></asp:Label>

            <asp:Button ID="save" runat="server" Text="SUBMIT" OnClientClick="return cal()" OnClick="save_Click" />
            </div>

    </div>
</ContentTemplate>
<Triggers>

   <asp:AsyncPostBackTrigger ControlID="save" />

 </Triggers>

 </asp:UpdatePanel>

**after click on Submit Button it Post back total page **

Itouch
  • 31
  • 2
  • 7
  • i had try many solutions like [this link ](http://stackoverflow.com/questions/3317286/asyncpostbacktrigger-not-working-in-my-application) but i'm working on Sharepoint visual WebPart ,so its not working for me – Itouch Aug 12 '15 at 11:30
  • use eventname of the controleID – Rojalin Sahoo Aug 12 '15 at 12:00

1 Answers1

0

Your save button is in your UpdatePanel by default you should use the ChildrenAsTriggers property of your UpdatePanel (set to true by default) and not AsyncPostBackTrigger.

Edit:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
    //...
</ContentTemplate>
</asp:UpdatePanel>

No external triggers just children as triggers, and default value as ChildrenAsTriggers is True equivalent to :

<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true">
Nab
  • 64
  • 4
  • i'm not understand, What are u trying to say , Can u Please write sample code, take reference from my above code – Itouch Aug 13 '15 at 06:18