RadAjaxManager不会在单击按钮时更新TextBox文本

时间:2019-02-24 21:58:23

标签: asp.net forms telerik

这是基本的工作流程。单击按钮时,我需要执行一个onclick事件,使API调用检索一些值,并在一些文本框控件上设置这些值。一切正常,除了文本框的值没有从后面的代码中保留下来,这让我发疯。希望有人能指出我在做什么错。谢谢。

RadAjaxManager

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="vehicleVinChecker">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="Panel_SearchBox" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
    </telerik:AjaxSetting>
</AjaxSettings>

加载面板

   <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" RegisterWithScriptManager="true">
<asp:Label ID="Label3" runat="server" ForeColor="Red">Loading... </asp:Label>
</telerik:RadAjaxLoadingPanel>

RadAjaxPanel

 <telerik:RadAjaxPanel runat="server" ID="Panel_SearchBox">
    <asp:Label runat="server" ID="lbl_automaticvinmessage" Font-Size="18px" Font-Bold="true" ForeColor="Red"></asp:Label>
    <asp:Label runat="server" ID="lbl_automaticvinsuccess" Font-Size="18px" Font-Bold="true" ForeColor="Green"></asp:Label>
    <br />
    <input runat="server" name="vehicleVinYearResultInput" id="vehicleVinYearResultInput" disabled="disabled" placeholder="Year" />
    <br />
    <input runat="server" name="vehicleVinMakeResultInput" id="vehicleVinMakeResultInput" disabled="disabled" placeholder="Make" />
    <br />
    <input runat="server" name="vehicleVinModelResultInput" id="vehicleVinModelResultInput" disabled="disabled" placeholder="Model" />
    <br />
    <asp:TextBox runat="server" ID="tctbx1"></asp:TextBox>
    <input type="button" value="Cancel" onclick="cancelWarranty();" />
    <input type="submit" value="Next" onclick="return goStep2();" />
</telerik:RadAjaxPanel>

onclick事件

protected void vehicleVinChecker_Click(object sender, EventArgs e)
    {
        lbl_automaticvinsuccess.Text = lbl_automaticvinmessage.Text = string.Empty;

        string vin = VIN;

        try
        {
            var x = new DecodeVin(vin);
            if (x.RequestSuccessful)
            {
//Why are none of these values retained when the radajaxmanager comes back
                vehicleVinYearResultInput.Value = x.Year.ToString();
                vehicleVinMakeResultInput.Value = x.Make;
                vehicleVinModelResultInput.Value = x.Model;
                lbl_automaticvinsuccess.Text = "Success!";
                tctbx1.Text = Guid.NewGuid().ToString();
                BuildWarranty(x);

            }
            else
                lbl_automaticvinmessage.Text = "Unable to verify the VIN.";
        }
        catch
        {
            lbl_automaticvinmessage.Text = "Unable to verify the VIN.";
        }
    }

0 个答案:

没有答案