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

Need to display data from code behind to main page Grid control

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
naimish
Top achievements
Rank 1
naimish asked on 06 Aug 2010, 03:38 PM
Hi,

In my code behind, iam fetching some data from webservice and manupulating it as per need and storing
into hashtable.

Now i wanted to display that hashtable data inside RADListView in the form of rows, The RadListView is under NestedViewTemplate of RadGrid.
I tried it to display, but data is not showing when i try to view in browser.
In the Control page (ascx):
<NestedViewTemplate>
<asp:Panel ID="panel2" runat="server" >                           
         <telerik:RadListView ID="RadListView2" runat="server">
                        
 <td >
                                 Address:<%# Eval("ADDRESS")%>
                         </td>
  <td>
                                <!-- Need to display----->
                       <asp:Label ID="Label11" runat="server" Text='<%#keysLst3[0].ToString() %>'>
                       </asp:Label>                                                
                 </td>
         </telerik:RadListView> 
</asp:Panel>
</NestedViewTemplate>

in Code behind (cs.ascx):

 protected void PopulateServices()
        {
   public ArrayList keysLst3 = null;
            public ArrayList list = null;
            public ArrayList actuaList = null;
            public Hashtable table = null;      

        public static ArrayList GetKeys(Hashtable table)
        {
            return (new ArrayList(table.Keys));
        }

   string ID1="someID1";
            string ID2="someID1
";
            
            list = new ArrayList();
            actuaList = new ArrayList();
            table = new Hashtable();
            
            actuaList.Add("A");
            actuaList.Add("CB");
            actuaList.Add("Adv");                    
 
            ServicesWS.RecordSoap service= new ServicesWS.RecordSoap();
            service.Credentials = CPUtil.GetUserCredentials();        

            // Call web service, convert it to list and setting up datasource
           int x = service.GetServices(ID1, ID2).Count<ServicesWS.Service>();

           for (int i = 0; i < x;i++ )
           {
               list.Add(service.GetServices(ID1, ID2).ElementAt<ServicesWS.Services>(i).NAME);
           }

           if (list.Count > 0)
           {
               for (int j = 0; j < list.Count; j++)
               {
                  
                           table.Add(list[j], 1);                      

               }

           }
            
                   for (int i = 0; i < actuaList.Count; i++)
                   {
                      
                          if (!table.ContainsKey(actuaList[i]))
                           {
                              
                               table.Add(actuaList[i], 0);
                              
                           } 
                   }


           keysLst3 = GetKeys(table);       

           // Need these data to display along with other data which are coming from DB.
            keysLst3[0].ToString();
            table[keysLst3[0]].ToString();
        }







1 Answer, 1 is accepted

Sort by
0
Accepted
Veli
Telerik team
answered on 11 Aug 2010, 03:34 PM
Hello naimish,

You need to have at least RadListView's ItemTemplate defined. For tabular data, refer to the RadListView predefined layouts demo to get acquainted with the various predefined listview layouts you can use, or to the RadListView custom layouts demo on how to customize your listview layout.

Greetings,
Veli
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
Tags
Grid
Asked by
naimish
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or