.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

How to use DataList in asp.net

Posted By: Ramesh     Posted Date: November 02, 2008    Points:2   Category :ASP.Net
How to use DataList in my Asp.Net Application. I want to use DataList.Please help me...

Thanks in Advance

Responses
Author: susant             
Posted Date: November 03, 2008     Points: 5   

Hi Ramesh \check this one..

1: take one datalist on ur .aspx page
2: in .cs file write the code to populate data
/*
string str = "select *from student";
SqlDataAdapter da = new SqlDataAdapter(str, con);
DataSet ds = new DataSet();
da.Fill(ds, "temp");
DataList1.DataSource = return_data(str, "temp");
DataList1.DataBind();
*/

3: In aspx source file:

<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<table>
<tr>
<td><%# DataBinder.Eval(Container.DataItem,"roll_no") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"s_name") %> </td>
<td><%# DataBinder.Eval(Container.DataItem,"city") %></td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>


Note: the code (Container.DataItem,"roll_no") from student table roll_no is the column name


Susant(9916351611)
Banglore



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend