-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: swati2040
Message 1 in Discussion

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





-----------------------------------------------------------

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]

Reply via email to