1

I am using ASP.NET update panel in SharePoint WebParts and I am Having the DropDown With AutoPostBack true firing the Event OnSelectedIndexChanged Page will get Fully refresh on DropDown Change.

Below is the Code Block Which I have Written.

<asp:UpdatePanel ID="updtPnlSchemeInfo" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
    <ContentTemplate>
        <asp:Panel ID="pnlSchemeInfo" runat="server">
            <asp:DropDownList ID="ddlDiscountRuleType" Style="width: 340px;" AutoPostBack="true" runat="server" CssClass="form-control" OnSelectedIndexChanged="ddlDiscountRuleType_SelectedIndexChanged"></asp:DropDownList>
        </asp:Panel>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="ddlDiscountRuleType" />
        <asp:PostBackTrigger ControlID="btnNextScheme" />
    </Triggers>
</asp:UpdatePanel>

Thanks in Advance!!

  • I tried running this code in my environment on firefox and its working as expected. Can you try changing the Triggers to <asp:AsyncPostBackTrigger ControlID="ddlDiscountRuleType" EventName="SelectedIndexChanged" /> and check either its working or not? – ThinkB4Code Jun 8 '17 at 7:08
  • You are doing it in the SharePoint WebPart? – Dinesh Talekar Jun 8 '17 at 7:27
  • Yes, SharePoint farm solution, with Visual Web part. – ThinkB4Code Jun 8 '17 at 7:39
  • Hi @DineshTalekar did you solve this problem? – Nderon Hyseni Jul 11 '18 at 8:04
0

Can you try following code? I checked with your code as well and it is also working me for.

<asp:UpdatePanel ID="ajaxUp" runat="server" UpdateMode="Conditional">
<ContentTemplate>
    <asp:DropDownList ID="ddlTest" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlTest_SelectedIndexChanged">
        <asp:ListItem Text="Select" Value="Select"></asp:ListItem>
        <asp:ListItem Text="Test" Value="Test"></asp:ListItem>
    </asp:DropDownList>
    <asp:TextBox ID="txtTest" runat="server"></asp:TextBox>
</ContentTemplate>
<Triggers>
    <asp:AsyncPostBackTrigger ControlID="ddlTest" EventName="SelectedIndexChanged" />
</Triggers>

Code behind file:


protected void ddlTest_SelectedIndexChanged(object sender, EventArgs e)
{
    txtTest.Text = "Changed from ddlTest_SelectedIndexChanged event";
    ajaxUp.Update();
}
  • Tried With the Same Still doesn't Work :( . It is not getting refresh every time. I will get refresh sometime after two three times DropDown change – Dinesh Talekar Jun 8 '17 at 14:59
  • Page is getting full refresh only if I get it idle for some time – Dinesh Talekar Jun 9 '17 at 7:15
  • this is normal behavior. – ThinkB4Code Jun 9 '17 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.