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

RadAjaxManager Making RadNumericTextBox Value Disappear

1 Answer 133 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Aaron Gravois
Top achievements
Rank 1
Aaron Gravois asked on 05 May 2011, 07:35 PM
The server I'm developing on is running IIS 7.5, and my company uses Internet Explorer 8.  In my program, I have a series of steps that a user has to go through in sequence.  As one step is completed (via a button click), another step loads.  The steps are each in Panels, and I use a RadAjaxManager to update the next panel on button clicks so that the next panel is made visible.  The odd problem that I'm having right now is that whenever the next panel loads, the first RadNumericTextBox within the newly loaded panel will not hold the value typed into it.  For example, if, once the text box loads, the user types "100" and goes to the next text box, "100" will stay in the box, but if I were to try to find its value server-side, it would be blank.  If i were to click on the text box again, the value "100" will disappear.  Upon typing in the value again, it will change to "100.00" like it's supposed to whenever it loses focus, and the value will be available server-side.  This happens randomly, but if it does happen, it will only happen on the first time and on the first box.  Any help is much appreciated.

Here is my Markup:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="lookupButton">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="orderPanel" LoadingPanelID="RadAjaxLoadingPanel1" />      
                        <telerik:AjaxUpdatedControl ControlID="errorLabel"/>                                                                                   
                        <telerik:AjaxUpdatedControl ControlID="countPanel" LoadingPanelID="RadAjaxLoadingPanel1" />  
                        <telerik:AjaxUpdatedControl ControlID="orderCount" LoadingPanelID="RadAjaxLoadingPanel1" />  
                        <telerik:AjaxUpdatedControl ControlID="amountPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>           
                <telerik:AjaxSetting AjaxControlID="inputButton">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="amountPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="amountList" LoadingPanelID="RadAjaxLoadingPanel1" />       
                        <telerik:AjaxUpdatedControl ControlID="errorLabel"/>                                                                                   
                    </UpdatedControls>
                </telerik:AjaxSetting>           
                <telerik:AjaxSetting AjaxControlID="printButton">
                    <UpdatedControls>                       
                        <telerik:AjaxUpdatedControl ControlID="errorLabel"/>                                       
                        <telerik:AjaxUpdatedControl ControlID="printButton" LoadingPanelID="RadAjaxLoadingPanel1" />                                           
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>       
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="WebBlue" />
    <asp:Panel ID="orderPanel" runat="server" DefaultButton="lookupButton">
        <fieldset>
            <legend>Order Information</legend>
            <table>
                <tr>
                    <td align="left"><telerik:RadNumericTextBox ID="orderNum" Width="150px" runat="server" MaxLength="6" NumberFormat-DecimalDigits="0" NumberFormat-GroupSeparator="" DataType="Int32"></telerik:RadNumericTextBox></td>
                    <td align="left"><asp:Button ID="lookupButton" runat="server" Text="Look Up Order" OnClick="LookupButton_Click" /></td>
                </tr>
                <tr>
                    <td align="left"><asp:Label ID="orderSalesText" runat="server" Font-Size="Small" Font-Bold="true" Text="Money Order Amount: "></asp:Label></td>
                    <td align="left"><asp:Label ID="orderSalesValue" runat="server" Font-Size="Small" Font-Bold="true"></asp:Label></td>
                </tr>
                <tr>
                    <td align="left"><asp:Label ID="orderFeesText" runat="server" Font-Size="Small" Font-Bold="true" Text="Money Order Fees: "></asp:Label></td>
                    <td align="left"><asp:Label ID="orderFeesValue" runat="server" Font-Size="Small" Font-Bold="true"></asp:Label></td>
                </tr>
            </table>
        </fieldset>
    </asp:Panel>
    <br />
    <br />
    <asp:Panel ID="logPanel" runat="server">
         
    </asp:Panel>
    <asp:Panel ID="countPanel" runat="server" DefaultButton="inputButton" Visible="false">
        <fieldset>
            <legend>Total Money Orders</legend>
            <table>
                <tr>
                    <td align="left"><telerik:RadNumericTextBox ID="orderCount" Width="150px" runat="server" MaxLength="2" NumberFormat-DecimalDigits="0" NumberFormat-GroupSeparator="" DataType="Int32"></telerik:RadNumericTextBox></td>
                    <td align="left"><asp:Button ID="inputButton" runat="server" Text="Enter Count" OnClick="InputButton_Click" /></td>
                </tr>
            </table>
        </fieldset>
    </asp:Panel>
    <br />
    <br />
    <asp:Panel ID="amountPanel" runat="server" Visible="false" DefaultButton="printButton">
        <telerik:RadListView ID="amountList" runat="server" ItemPlaceholderID="amountPlaceHolder">
            <LayoutTemplate>
                <fieldset>
                    <legend>Money Order Amounts</legend>
                    <asp:Panel ID="amountPlaceHolder" runat="server"></asp:Panel>
                </fieldset>
            </LayoutTemplate>           
            <ItemTemplate>
                <center>
                    <table>
                        <tr>
                            <td align="right"><asp:Label ID="amountLabel" runat="server" Text="<%# Container.DataItem.ToString() %>" Font-Bold="true" Font-Size="Small"></asp:Label></td>
                            <td align="left"><telerik:RadNumericTextBox ID="amountBox" Width="150px" runat="server" NumberFormat-DecimalDigits="2" DataType="double"></telerik:RadNumericTextBox></td>                           
                        </tr>
                    </table>
                </center>       
            </ItemTemplate>
        </telerik:RadListView>           
        <br />
        <br />
        <center>
            <asp:CheckBox ID="suspFlag" runat="server" /><asp:Label runat="server" ID="suspText" Text="This order is suspicious" Font-Bold="true" Font-Size="Small"></asp:Label>
            <br />
            <asp:Button ID="printButton" runat="server" Text="Print Money Orders" OnClick="PrintButton_Click" />
        </center>           
    </asp:Panel>

Here is my server-side code:
public partial class MoneyOrder_Create : System.Web.UI.Page
{
    ACROrder order = ACRFunctions.Order;
    int moneyOrderCount = ACRFunctions.OrderCount;
    protected void Page_Load(object sender, EventArgs e)
    {
        ((AppMasterPage)Master).verNum = "3.5";
        ((AppMasterPage)Master).visibleHome = true;
        ((AppMasterPage)Master).AppName = "Money Order Creation";
        ((AppMasterPage)Master).visibleBreadCrum = true;
        ((AppMasterPage)Master).subMenuName = navLastMenu.GetMenuLineApps(navLastMenu.GetPreviousMenuID(Convert.ToInt32(Session["SessionMenuID"])));
        if (Request.QueryString["error"] != null)
            errorLabel.Text = Request.QueryString["error"];
    }
 
    protected void LookupButton_Click(object sender, EventArgs e)
    {
        order = ACRFunctions.GetACROrder(Convert.ToInt32(orderNum.Text), true);
        if (order.Order_No == -1)
            SetLookupText("Cannot Find Order in ACR", "", "");           
        else
        {
            if (ACRFunctions.OrderIsMoneyOrder(order))
            {
                if (!ACRFunctions.OrderIsUsed(order))
                {
                    SetLookupText("", ACRFunctions.GetMoneyOrderSum(order).ToString("C"), ACRFunctions.GetMoneyOrderFees(order).ToString("C"));
                    SetFocus(orderCount);
                    ACRFunctions.Order = order;
                    countPanel.Visible = true;
                }
                else
                    SetLookupText("This ACR Order has already been used to print money orders", "", "");               
            }
            else
                SetLookupText("Not a Valid Money Order Transaction", "", "");               
        }
    }
 
    public void SetLookupText(string errorText, string salesText, string feesText)
    {
        errorLabel.Text = errorText;
        orderSalesValue.Text = salesText;
        orderFeesValue.Text = feesText;
        if (salesText == "")
        {
            countPanel.Visible = false;
            amountPanel.Visible = false;
        }
    }
 
    protected void InputButton_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(orderCount.Text))
        {
            errorLabel.Text = "You Must Enter a Count";
            return;
        }
        else
        {
            moneyOrderCount = Convert.ToInt32(orderCount.Text);
            if (moneyOrderCount <= 0)
            {
                errorLabel.Text = "You Must Enter a Positive Number";
                amountList.DataSource = null;
                return;
            }
            errorLabel.Text = "";
            amountPanel.Visible = true;
            ArrayList list = new ArrayList();
            for (int i = 0; i < moneyOrderCount; i++)
            {
                list.Add("Amount " + (i + 1) + ": ");
            }
            amountList.DataSource = list;
            ACRFunctions.OrderCount = moneyOrderCount;           
        }
    }
 
    protected void PrintButton_Click(object sender, EventArgs e)
    {
        List<decimal> amounts = new List<decimal>();
        foreach (var item in amountList.Items)
        {
            if (string.IsNullOrEmpty(((item.FindControl("amountBox") as RadNumericTextBox).Text)))
            {
                errorLabel.Text = "You must enter an amount for each money order.  Change the count if you entered too many.";
                return;                                            
            }
            else if (Convert.ToDecimal((item.FindControl("amountBox") as RadNumericTextBox).Text) <= 0)
            {
                errorLabel.Text = "Money Order Amounts Must Be Greater than Zero.";
                return;                                            
            }
            else
                amounts.Add(Convert.ToDecimal((item.FindControl("amountBox") as RadNumericTextBox).Text));
        }
        Printer printer = new Printer();
        string error = printer.PrintMoneyOrders(amounts, ACRFunctions.Order, suspFlag.Checked, Session["SessionUserNum"].ToString(), Request.ServerVariables["REMOTE_ADDR"]);
        if (!string.IsNullOrEmpty(error))
            errorLabel.Text = error;
        else
            errorLabel.Text = "Print Successful";
    }
}

Thanks,
Aaron

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 11 May 2011, 07:47 AM
Hello Aaron,

I am afraid that I am not able to build a runnable example based on your code. Could you please remove all unneeded functionality and try to send me a stripped runnable page that reproduces the issue? This way I will be able to debug it locally and provide you with more to the point resolution.

All the best,
Martin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Ajax
Asked by
Aaron Gravois
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or