Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is that is possible to create a new data table by getting values from a repeater control in asp.net?
Posted

1 solution

Yes Why Not ?

C#
 DataTable dt = new DataTable();

        dt.Columns.Add("Name"); // Add Column Name Here 
      

//Iterate Repeater

 foreach (var eachItem in Repeater1.Items)
        {

//Find Desired Control 
Label lblName=  (each as RepeaterItem ).FindControls("MyLabel");


        dt.Rows.Add(lblName.Text); // Add Data 

        }
 
Share this answer
 
v2
Comments
idhris2011 24-Mar-12 6:22am    
bro....
eachitem is not having definition for findcontrol
Hammad Abbasi 24-Mar-12 7:25am    
Cast that into RepeaterItem Object, Solution Imroved.
idhris2011 29-Mar-12 6:00am    
sorry for late reply....

It worked...thnx again Bro

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900