C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Data in Repeater


Posted Date: 22 Aug 2008    Resource Type: Code Snippets    Category: Tools

Posted By: amit chaudhary       Member Level: Silver
Rating:     Points: 8



Add a Repeater on the design page:

<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table cellpadding="5" cellspacing="2" >
<tr bgcolor=Gray>
<td><b>Name</b></td>
<td><b>Country</b></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem,"Name") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"Country") %></td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr bgcolor="#ccccff">
<td><%# DataBinder.Eval(Container.DataItem,"Name") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"Country") %></td>
</tr>
</AlternatingItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

On code page write the following code on page Load:-

DataSet ds = new DataSet();
DataTable dt = ds.Tables.Add("Employee");
dt.Columns.Add("Name", Type.GetType("System.String"));
dt.Columns.Add("Country", Type.GetType("System.String"));
DataRow dr = dt.NewRow();
dr[0] = "amit";
dr[1] = "India";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "rajinder";
dr[1] = "SriLanka";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "parmod";
dr[1] = "UK";
dt.Rows.Add(dr);
Repeater1.DataSource = ds;
Repeater1.DataMember = "Employee";
Repeater1.DataBind();




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Repeater control  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to capture Screenshots in C#.Net
Previous Resource: Three Layer Architecture For Web Applications
Return to Discussion Resource Index
Post New Resource
Category: Tools


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

efax

Contact Us    Privacy Policy    Terms Of Use