2012-01-06 62 views
0

我如何能实现重新排序列表通过结合数据从数据库重新排序列表,而不在使用的数据库我收到警报消息

“重新排序失败使用数据源

,请参见下面的详细信息。\ r \ n \ r \ nCan't重新排序datasource.it不是一个数据源,并且不实现IList”

我怎么能落实结合数据从数据库

回答

1
Try this way, 
  1. 创建方法来填充该数据集

    公共数据集FillDataSet_info(串_param1) {

     try 
         { 
          DataSet oDS = new DataSet(); 
          SqlParameter[] oParam = new SqlParameter[1]; 
    
          oParam[0] = new SqlParameter("@Column_Filed1", _param1; 
    
    
          oDS = SqlHelper.ExecuteDataset(DataConnectionString, CommandType.StoredProcedure, "proc_fill", oParam); 
          return oDS; 
         } 
         catch (Exception e) 
         { 
          ErrorMessage = e.Message; 
          return null; 
         } 
        } 
    
  2. 现在,使用上述填充的ListView,GridView中,DataList或Repeater

您所要做的就是创建一个绑定GridView或其他数据的方法..

private void GridView_Bind() 
     { 
      DataSet oDs_GridView = new DataSet(); 
     string Param1 = "somevalue"; 
      oDs_GridView = oFCC.GetmRoleMaster_infoAll(Param1); 
      if (oDs_GridView.Tables[0].Rows.Count > 0) 
      { 
       GridView1.DataSource = oDs_GridView; 
       GridView1.DataBind(); 



      } 
     } 
+0

谢谢,但我的问题是不绑定数据,每当我重新排列重新排序列表,它会发出上述提醒 – Vinod 2012-01-06 06:28:41

+1

您需要添加OnItemReorder以重新排列列表。使用此链接找到更多的细节.http://stackoverflow.com/questions/7454972/asp-net-ajax-like-reorder-list – AnandMohanAwasthi 2012-01-06 06:49:03

相关问题