DataList Problem???hurry for help!!!

Discussion in 'ASP .Net Datagrid Control' started by Àä×ÔȪ, Apr 1, 2004.

  1. Àä×ÔȪ

    Àä×ÔȪ Guest

    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.
    Àä×ÔȪ, Apr 1, 2004
    #1
    1. Advertising

  2. Àä×ÔȪ

    Àä×ÔȪ Guest

    I'm sorry ,the problem is the DataList only diskplay the Rows of 1,3,5,7.Not
    the column.

    "Àä×ÔȪ" <> дÈëÏûÏ¢
    news:#...
    > 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.
    >
    >
    Àä×ÔȪ, Apr 1, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hurry! Query Need help.

    , Jul 12, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    350
    tfsmag
    Jul 12, 2006
  2. Replies:
    1
    Views:
    2,362
    Danno
    Jul 6, 2006
  3. Roops
    Replies:
    1
    Views:
    1,183
    Hunter Gratzner
    Jun 9, 2007
  4. wangmaker
    Replies:
    0
    Views:
    261
    wangmaker
    Jan 6, 2008
  5. anjali
    Replies:
    1
    Views:
    328
    Puppet_Sock
    May 1, 2008
Loading...

Share This Page