----------------------------------------------------------- New Message on MumbaiUserGroup
----------------------------------------------------------- From: PreetamKumar Message 2 in Discussion for this you need to use nested datalist.... parent will be holding distinct title , and child datalist will be holding the employee name.. prakash -----Original Message----- From: MumbaiUserGroup [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 4:31 PM To: MumbaiUserGroup Subject: DataList problem New Message on MumbaiUserGroup DataList problem Reply Recommend Message 1 in Discussion From: swati2040 hello sir i have some problem in the code i m writing n thought u could help me. I m using DataList Control. I have set the datalist control's attribute RepeatColumns="4" I am retrieving data from employee table of Northwind database. I am retrieving data from fields "Title" and "LastName" from the employee table and i have used the query "SELECT * FROM Employees order by title " to get the result in an ascending order(Title). however i want that whenever the "title" is same the repeat columns should function as needed that is data for same title should be one after the other But as soon as "title" changes control should go on next line. So my problem is i am not able to take the control on next line when the "title" changes.. I am sending u the code here..its written in vb. i hope u can help me Thanx HTML CODE <form id="Form1" method="post" runat="server"> <ASP:DATALIST id=DataList1 runat="server" RepeatColumns="4" RepeatDirection="Horizontal"> <headerTemplate> <table width="100%"> </headerTemplate> <FOOTERTEMPLATE> </table> </FOOTERTEMPLATE> <ITEMTEMPLATE> <table cellpadding="0" cellspacing="0" border="1" width="250"> <tr> <td> <ASP:LABEL id=Label1 runat="server">Title:</ASP:LABEL> <%# DataBinder.Eval(Container.DataITem, "Title") %> </td> </tr> <tr> <td> <ASP:LABEL id=Label2 runat="server">Name:</ASP:LABEL> <%# DataBinder.Eval(Container.DataITem, "LastName") %> </td> </tr> </table> </ITEMTEMPLATE> </ASP:DATALIST></form> CODE BEHIND Imports System.Data Imports System.Data.SqlClient Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then BindTitle() End If End Sub Sub BindTitle() Dim ds As New DataSet Dim sqlStmt As String = "SELECT * FROM Employees order by title" Dim conString As String = "server=localhost;database=Northwind;uid=sa;pwd=;" Dim myda As SqlDataAdapter = New SqlDataAdapter(sqlStmt, conString) myda.Fill(ds, "Table") DataList1.DataSource = ds DataList1.DataBind() End Sub View other groups in this category. ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
