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

[Solved] RadAjaxManager and Panel inside a FormView

3 Answers 186 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Sima Ganji
Top achievements
Rank 1
Sima Ganji asked on 06 Jul 2009, 05:49 PM
Hi Folks,

I have a FormView that contains a RadComboBox named ComboBox1 and a few other controls which I need to show or hide based on the ComboBox1 selected value using SelectedIndexChanged event.I put those controls inside a panel named Panel1.
This is the setting in the code behind:

protected v

 

oid Page_PreRenderComplete(object sender, EventArgs e)

 

 

 {

      

RadComboBox item1 = (RadComboBox)MyFormView.FindControl("ComboBox1");

 

 

     

Panel panel1 = (Panel)MyFormView.FindControl("Panel1");

 

 

     

RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(item1 , panel1);

 

 

}

When I run the app and change the combobox1 value, I get this error: Unknown runtime error. 
debuged it the error comes from

 

 

"updatePanelElement.innerHTML=rendering;" line

The thing is it works when I use another control but not the panel inside the FormView.

Thanks in advance for your help.
Sima

 

 

 

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 07 Jul 2009, 01:49 PM
Hello Sima,

I am afraid that the provided information is not enough to determine the exact source of the issue you are facing. At this point it will be best if you open a formal support ticket and send us a simple working project that isolates the problem so we can check it.
Meanwhile I suggest you handles on Page_PreRender event instead of Page_PreRenderComplete and let me know if it makes any difference.

Best wishes,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sima Ganji
Top achievements
Rank 1
answered on 07 Jul 2009, 04:35 PM
Hi Pavlina,

Thanks for your reply.I tried Page_PreRender instead of Page_PreRenderComplete  and I still get the same error.I suspect that ajaxifying a Panel inside a FormView might be having problem.Because when I use another control like RadTextBox to be updated after ComboBox1 selected value changes,it works fine.

protected void Page_PreRenderComplete(object sender, EventArgs e)

{
    RadComboBox item1 = (RadComboBox)MyFormView.FindControl("ComboBox1"); 
    //This Works
    RadTextBox text1 = (RadTextBox )MyFormView.FindControl("Text1");
    RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(item1 , text1); 
    //This does not work
    //Panel panel1 = (Panel)MyFormView.FindControl("Panel1");  
    //RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(item1 , panel1); 
   }
When I change selection from ComboBox1, Text1 will be
 shown or hidden according to the ComboBox1.SelectedValue without getting any error.there are like 10 controls which I need to hide or show when ComboBox1 value is changed.I wrap them inside a panel to be able to hide or show all those controls at once.So in my FormView I have some controls,ComboBox1,Panel1 which includes 10 table rows containing those controls.
This is the ComboBox1 SelectedIndexChanged event handler:

 

protected void ComboBox1_SelectedIndexChanged(object sender, EventArgs e)

 

{

    RadComboBox item1= (RadComboBox)sender;

 

 

     long itemValue= Convert.ToInt64(item1.SelectedValue);
    //This Works  
    //RadTextBox
text1 = (RadTextBox )MyFormView.FindControl("Text1");
    //text1 .Visible = ShowOrHide(itemValue);
    //This doesn't work

 

 

    Panel panel1= (Panel)MyFormView.FindControl("Panel1");

 

    panel1.Visible = ShowOrHide(itemValue);

}
Please Let me know if you still want me to send you the code.
Thanks.
Sima

0
Pavlina
Telerik team
answered on 09 Jul 2009, 03:59 PM
Hello Sima,

I went through your code and was not able to find what have caused the unexpected behavior. In order to progress in the resolution of this matter I will ask you to prepare a simple runnable project illustrating the issue and sent it via a support ticket. Thus I could help you to find a quick solution/fix of this problem.

Sincerely yours,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Ajax
Asked by
Sima Ganji
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Sima Ganji
Top achievements
Rank 1
Share this question
or