A problem with DataList???Help!!!

  • Thread starter Thread starter Àä×ÔȪ
  • Start date Start date
À

Àä×ÔȪ

I insert a DataList and a Datagrid in a page:

<asp:DataGrid id="DataGrid1" style="Z-INDEX: 103; LEFT: 456px; POSITION:
absolute; TOP: 56px"runat="server"></asp:DataGrid>

<asp:DataList id="DataList2" style="Z-INDEX: 104; LEFT: 280px; POSITION:
absolute; TOP: 88px"runat="server">
<ItemTemplate>
<asp:Label id=Label6 runat="server" Text='<%#
DataBinder.Eval(Container.DataItem,"½òÌùÀà±ð") %>'></asp:Label>
</ItemTemplate>
<AlternatingItemTemplate>
<FONT face="ËÎÌå"></FONT>
</AlternatingItemTemplate>
</asp:DataList>

Then I bind data from sqlserver2000 like this;

private void Page_Load(object sender, System.EventArgs e)
{
System.Data.SqlClient.SqlConnection conn=new
System.Data.SqlClient.SqlConnection();
conn.ConnectionString="server=brhhk;user=sa;pwd=hk;database=br";
conn.Open();
System.Data.SqlClient.SqlCommand cmd=null;
cmd=new System.Data.SqlClient.SqlCommand("SELECT * FROM kyjt where
username='"+User.Identity.Name.Trim()+"'",conn);
System.Data.DataSet dataset=new DataSet();;
System.Data.SqlClient.SqlDataAdapter adapter=new
System.Data.SqlClient.SqlDataAdapter(cmd);
System.Data.DataTable t=new DataTable();
adapter.Fill(t);
DataGrid1.DataSource=t;
DataGrid1.DataBind();
DataList2.DataSource=t;
DataList2.DataBind();
adapter.Dispose();
conn.Close();
}
I bind the DataGrid and DataList with the same DataSource.
The DataGrid can property display the data i wanted,
But the DataList only display the column of 1,3,5,7.
I'm hurry for the program.I will great thanks if any one helps.
 
I'm sorry ,the problem is the DataList only diskplay the Rows of 1,3,5,7.Not
the column.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top