I have a problem with 2 of my controls "disappearing" when I use the RadAjaxManager to update them when I click a button.
Here is my button:
<asp:Button runat="server" id="btnClick" OnClick="btnClick_Click" />
Here is the btnClick_Click in my C# file:
protected void btnClick_Click(object sender, EventArgs e)
SqlConnection myConn3 = new SqlConnection("Dataconnection");
getCategoryQueryString = "SELECT MasterTableCategories.MasterID, MasterTableCategories.SICCode, [Sic-Codes].[SIC Name1] AS Category FROM MasterTableCategories INNER JOIN [Sic-Codes] ON MasterTableCategories.SICCode = [Sic-Codes].[SIC Code1] WHERE (MasterTableCategories.MasterID = @MasterID)";
SqlCommand getCategoryQuery = new SqlCommand(getCategoryQueryString, myConn3);
SqlDataReader getCategoryReader = getCategoryQuery.ExecuteReader();
Category.Text = getCategoryReader["Category"].ToString();
SICCode.Value = getCategoryReader["SICCode"].ToString();
//For testing purposes
Category.Text = "Cars";
SICCode.Value = "123456789";
Here is the Ajax:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel_CampaignChange">
<telerik:AjaxUpdatedControl ControlID="Category" />
<telerik:AjaxUpdatedControl ControlID="SICCode" />
Here are the controls:
<asp:TextBox ID="Category" runat="server" Width="100%" ReadOnly="true"></asp:TextBox>
<asp:HiddenField ID="SICCode" runat="server" Value="" />
The user presses the button and the btnClick_Click goes to the database and retrieves the Category and SIC Code. It's then supposed to update the controls with string data, but makes the ENTIRE textbox and hidden field disappear from the html. All I am left with is an empty div...sort of. It even removes the CategoryPanel div and SICCodePanel div from the html.
If anyone has a clue why these controls vanish, I would appreciate it immensely!
10 Answers, 1 is accepted
Please check the following:
1. Do you get a valid server response during the AJAX request?
3. Is the page HTML markup valid?
If all the points above seem OK, please send a simple runnable sample and we will inspect it locally. Thanks,
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
Was there ever any outcome to this problem? I'm having exactly the same issue. The server side is assigning the correct value to the text box but when the page redisplays the text box has vanished.
Could you please elaborate a bit more on the scenario you have and provide answers of the previously posted support questions?
the Telerik team
I have an aspx page that contains a number of required text boxes. One of the boxes can be optionally filled with a default value by pressing a button on the form. Ajax is required to circumvent the posting of the whole form as most of the other required boxes will not be filled when the button is pressed. So I set it up as follows...
In the radajax manager settings I have
Following the loading pannel set up is
<telerik:RadCodeBlock ID="cb1" runat="server">
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
ajaxManager.ajaxRequestWithTarget('<%= btnCompName.UniqueID%>', '');
<asp:TextBox ID="txtComponentId" runat="server" MaxLength="50" Width="200px"></asp:TextBox>
<input type="button" onclick="AjaxRequestButton(); return false;" style="visibility:hidden" />
<asp:Button ID='btnCompName' runat='server' CssClass='library_button' Height='23' Width='55'
OnClick='btnCompName_Click' Text='Name it' />
In the code behind the page I have
protected void btnCompName_Click(object sender, System.EventArgs e)
componentBLL objcomponentBLL = new componentBLL();
string NextCID = objcomponentBLL.GiveCompName().ToString();
txtComponentId.Text = NextCID;
//btnCompName.Enabled = false;
When I press the button, the text box vanishes. Tracing through the code shows that the text box is being set to the correct value.
To answer the support questions, The server is sending the correct value, there's no java errors or html markup errors. Apart from this issue, the rest of the page works perfectly.
Thanks in advance.
Could you please try adding setting into your RadAjaxManager settings in which the AjaxManager itself updates the mentioned textbox?
Give this suggestion a try and let me know how it goes.
the Telerik team
Thanks for your reply. I tried your suggestion but sadly it didn't make a difference. The text box still dissappeared. DO you have any other suggestions please?
It will be very helpful if you could open a regular support ticket and send us sample runnable application which demonstrates the issue you are facing. Thus we will be able to debug it locally and isolate the root cause of the presented problem.
All the best,
the Telerik team
I am trying to replace AjaxControlToolkit with telerik. I have webusercontrol loaded and added dynamically at pageinit. This user control has a RadWindow. In the RadWindow when I do a partial postback using AjaxManagerProxy the affected controls dissapear from the RadWindow contents. Although I found them on the main page!
No js errors and postback does it job well on server side. The values are also correctly set.
In most cases the described issue appear when the UserControls are not properly loaded on the page. Please make sure that the controls are added on each postback.
I would suggest you to open separate threads for the specific cases you have and post your page markup and related code behind. Thus we will be bale to further investigate your scenarios and advise you for possible solutions.
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.