This is a migrated thread and some comments may be shown as answers.

DropDown in AjaxPanel?

2 Answers 24 Views
AjaxPanel
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 19 Nov 2015, 04:22 PM

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 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 19 Nov 2015, 04:44 PM
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?
0
Maria Ilieva
Telerik team
answered on 23 Nov 2015, 02:49 PM
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
Tags
AjaxPanel
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or