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

Dynamic RadPanels

1 Answer 144 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Officialboss
Top achievements
Rank 1
Officialboss asked on 10 Jul 2008, 11:31 PM
<telerik:RadPanelBar runat="server" ID="RadPanelBar1" Skin="Mac" Height="100%" ExpandMode="FullExpandedItem" 
OnItemDataBound="RadPanelBar1_OnItemDataBound"
     
</telerik:RadPanelBar> 
<asp:XmlDataSource ID="xdsSummary" runat="server" XPath="Summaries/Items/Summary" EnableCaching="false" /> 

I am populating the RadPanelBar above as such:
this.xdsSummary.DataFile = "http://mywebservice/myService.asmx/GetSummaryContainer?acct=1234"
RadPanelBar1.DataSource = this.xdsSummary; 
RadPanelBar1.DataBind(); 

The DataFile for the xml datasource returns:
             <?xml version="1.0" encoding="utf-8" ?>  
<Summaries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<Items> 
<Summary> 
  <Title>Title 1</Title>   
  </Summary> 
<Summary> 
  <Title>Title 2</Title>    
  </Summary>-  
  </Items> 
  </Summaries> 

I then bind the Title of the RadPanel:
    protected void RadPanelBar1_OnItemDataBound(object sender, Telerik.Web.UI.RadPanelBarEventArgs e) 
    { 
        System.Xml.XmlElement xmlElement = e.Item.DataItem as System.Xml.XmlElement; 
 
        foreach (System.Xml.XmlNode node in xmlElement.ChildNodes) 
        { 
            if (node.Name == "Title"
                e.Item.Text = node.InnerText; 
        } 
    } 

Now, within each of the Panel, I want to call another web service asynchronously and display some text. The web service returns string as such;
  <?xml version="1.0" encoding="utf-8" ?>  
  <string><div id="WidgetContent"<script type="text/javascript"> //<![CDATA[ Sys.WebForms.PageRequestManager._initialize('ctl02$ScriptManager1', document.getElementById('ctl01')); Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90); //]]> </script> <div> <table cellspacing="0" border="0" id="ctl02_DetailsView1" style="border-collapse:collapse;"<tr> <td colspan="2"><b>Account Type:</b></td><td></td</tr></table</div> </div> <script type="text/javascript"> //<![CDATA[ Sys.Application.initialize(); //]]> </script></string>  

How can I do this?

Thanks












1 Answer, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 14 Jul 2008, 06:50 AM
Hi Howard,

You can use  the ScriptManger control to call a web service which will return you some data(text or array).
Please see here for more details.

Then you can subscribe to the SucceededCallback event  and create an item in its event handler by using the data returned form the web service:

for example:
function SucceededCallback(result)  
{  
       var panel = $find("RadPanelBar1");  
       var item = new Telerik.Web.UI.RadPanelItem()'  
       item.set_text(result);  
       panel.get_items().add(item);  
 
}  
 

Hope this helps.

Kind regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
PanelBar
Asked by
Officialboss
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Share this question
or