DropDown in AjaxPanel?

3 posts, 0 answers
  1. John
    John avatar
    41 posts
    Member since:
    Jun 2008

    Posted 19 Nov 2015 Link to this post

    Hello:

    I have an AjaxPanel with a dropdown list, chart, and textbox and am trying to get the value of the dropdown list from OnSelectedIndexChanged, but for some reason it is not working, I always get 0 in the textbox, and when I put a break point in the method it is never reached.

       <div class="demo-container size-wide">
            <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" Height="600px" Width="800px">
     
              <asp:Label ID="Label1" runat="server" Text="Start Date: "></asp:Label><asp:DropDownList ID="drpStartDate" runat="server" AutoPostBack="true" ></asp:DropDownList>
              <asp:Label ID="Label2" runat="server" Text="End Date: "></asp:Label><asp:DropDownList ID="drpEndDate" runat="server" AutoPostBack="true" ></asp:DropDownList>
              <asp:Label ID="Label3" runat="server" Text="Select Chart: "></asp:Label><asp:DropDownList ID="drpChart" runat="server" AutoPostBack="true" OnSelectedIndexChanged="drpChart_SelectedIndexChanged" ></asp:DropDownList>

     
              <telerik:RadHtmlChart ID="RadHtmlChart1" runat="server" Width="800px" Height="500px">
              <PlotArea>
                   <XAxis AxisCrossingValue="0" Color="black" MajorTickType="Outside" MinorTickType="Outside" Reversed="false" DataLabelsField="Date">
                        <LabelsAppearance DataFormatString="{0}" RotationAngle="0" Skip="0" Step="1">
                        </LabelsAppearance>
                        <TitleAppearance Position="Center" RotationAngle="0" Text="Days">
                        </TitleAppearance>
                    </XAxis>
              <Series>
                <telerik:LineSeries Name="Net Collections" DataFieldY="NetCollections">
                    <LabelsAppearance DataFormatString="${0}" Position="Above" />
                    <MarkersAppearance MarkersType="Circle" />
                </telerik:LineSeries>
                   <telerik:LineSeries Name="Net Production" DataFieldY="NetProduction">
                    <LabelsAppearance DataFormatString="${0}" Position="Above" />
                    <MarkersAppearance MarkersType="Circle" />
                </telerik:LineSeries>
            </Series>
        </PlotArea>
        <Legend>
            <Appearance Visible="false" />
        </Legend>
        <ChartTitle Text="Net Production vs Net Collections">
        </ChartTitle>

              </telerik:RadHtmlChart>

                    <asp:TextBox ID="txtDebug" runat="server" Height="177px" TextMode="MultiLine" Width="547px"></asp:TextBox>

        </telerik:RadAjaxPanel>

        </div>

    string[] sCharts = new string[] { "Select Chart...",
                                          "Net Production vs Net Collections",
                                          "Collection Ratio",
                                          "Hygiene Ratio",
                                          "Production Adjustment Ratio",
                                          "New Patients",
                                          "Accounts Receivable vs Collections"};

            drpChart.DataSource = sCharts;
            drpChart.DataBind

        protected void drpChart_SelectedIndexChanged(object sender, EventArgs e)
        {
          txtDebug.Text += drpChart.SelectedIndex.ToString();
          txtDebug.Text += drpChart.SelectedItem.ToString();
          txtDebug.Text += drpChart.SelectedValue;
        }

     
     
  2. John
    John avatar
    41 posts
    Member since:
    Jun 2008

    Posted 19 Nov 2015 in reply to John Link to this post

    When I run the page and make a selection from the DropDown, the page refreshes and automatically sets the dropdown back to "Select Chart..." Not sure if that is because of the AjaxPanel, the autopostback, or?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 23 Nov 2015 Link to this post

    Hello John,

    Please revise the answer provided in the other thread you have opened for the same issue and see if it helps.

    Regards,
    Maria Ilieva
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top