******* 请问在DataGrid控件里怎么让数据按2列来显示并且分页?
有具体的例子或代码吗?

解决方案 »

  1.   

    这没有什么问题。你以数据按2列为关键字。。就可以啦http://www.cnblogs.com/meetweb/archive/2005/04/19/140239.html
    http://www.cnblogs.com/meetweb/archive/2005/02/22/107481.aspx
      

  2.   

    <asp:TemplateColumn HeaderText="图片2"> 
    <ItemTemplate>
    <a href="viewgoods.aspx?goodsid=<%# DataBinder.Eval(Container.DataItem,"goodsid") %>"><img src="../<%# DataBinder.Eval(Container.DataItem,"goodsimage") %> " width=95px height=95px border=0px></a>
    </ItemTemplate>
    </asp:TemplateColumn>
      

  3.   

    首先:你要對HTML中的Table進行了解,如果是兩列。一般做法是在DataGrid數據綁定來輸出需要的HTML代碼。
      

  4.   

    private void DataGrid_MatOld_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    if(e.Item.ItemIndex>=0)
    {
    e.Item.Style.Add("cursor","hand");
    e.Item.Attributes.Add("Onclick","OnClick_TRItem(this)");
    e.Item.Attributes.Add("onmouseover","OnMouseOver_TRItem(this)");
    e.Item.Attributes.Add("onmouseout","OnMouseOut_TRItem(this)");
    }
    }
    以上是向DataGrid載入數據,每一行加入客戶端事件的代碼,你可能可以參考一下