À
Àä×ÔȪ
I insert a DataList and a Datagrid in a page:
<asp
ataGrid id="DataGrid1" style="Z-INDEX: 103; LEFT: 456px; POSITION:
absolute; TOP: 56px"runat="server"></asp
ataGrid>
<asp
ataList 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
ataList>
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.
<asp

absolute; TOP: 56px"runat="server"></asp

<asp

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

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.