2012-01-06 59 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

相關問題