Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 也不会在网格中填充下一批数据。你们有没有人知道如何解决这个问题?_C#_Jquery_Asp.net_Ajax - Fatal编程技术网

C# 也不会在网格中填充下一批数据。你们有没有人知道如何解决这个问题?

C# 也不会在网格中填充下一批数据。你们有没有人知道如何解决这个问题?,c#,jquery,asp.net,ajax,C#,Jquery,Asp.net,Ajax,当向下滚动以获得更多结果时,必须从数据库中获取数据,并将其与gridview数据源中的当前数据合并,如下所示 private string PrepareDataSet(int LAST_TRIAL_USER_DETAIL_ID) { System.Data.SqlClient.SqlConnection conn = new SqlConnection("my connection string"); string _cmdText = "Select

当向下滚动以获得更多结果时,必须从数据库中获取数据,并将其与gridview数据源中的当前数据合并,如下所示

private string PrepareDataSet(int LAST_TRIAL_USER_DETAIL_ID)
    {
        System.Data.SqlClient.SqlConnection conn = new SqlConnection("my connection string");
        string _cmdText = "Select TOP 10 TRIAL_USER_DETAIL_ID,Convert(Varchar,TRIAL_ACTIVATE_DATE,103) ActivateDate,TRIAL_CD_SERIAL_NO From TDSMAN_TRIAL_USER_DETAIL Where TRIAL_USER_DETAIL_ID >" + LAST_TRIAL_USER_DETAIL_ID;

        SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(_cmdText, conn);
        DataSet ds = new System.Data.DataSet();
        da.Fill(ds,  "User_Detail");

        //get the previous data from chche
        var parentDt = (DataSet)_cache["key For previous data in cache"];
        ds.Merge(parentDt);  
        tblUserDetail.DataSource = ds;
        tblUserDetail.DataBind();  

        //this when this function is in the page 
        //but if the function is in the handler you can return dataset to the page and //bind it to the tblUserDetail GridView like above

        //Notes:
        //-you don't need to build rows you just bind the new ds to the gridview.
        //-when you get the first data on page load save the data into the cache or 
        //any state management variables.
    }

我希望这能有所帮助:)

当向下滚动以获得更多结果时,您必须从数据库中获取数据,并将其与gridview数据源中的当前数据合并,如下所示

private string PrepareDataSet(int LAST_TRIAL_USER_DETAIL_ID)
    {
        System.Data.SqlClient.SqlConnection conn = new SqlConnection("my connection string");
        string _cmdText = "Select TOP 10 TRIAL_USER_DETAIL_ID,Convert(Varchar,TRIAL_ACTIVATE_DATE,103) ActivateDate,TRIAL_CD_SERIAL_NO From TDSMAN_TRIAL_USER_DETAIL Where TRIAL_USER_DETAIL_ID >" + LAST_TRIAL_USER_DETAIL_ID;

        SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(_cmdText, conn);
        DataSet ds = new System.Data.DataSet();
        da.Fill(ds,  "User_Detail");

        //get the previous data from chche
        var parentDt = (DataSet)_cache["key For previous data in cache"];
        ds.Merge(parentDt);  
        tblUserDetail.DataSource = ds;
        tblUserDetail.DataBind();  

        //this when this function is in the page 
        //but if the function is in the handler you can return dataset to the page and //bind it to the tblUserDetail GridView like above

        //Notes:
        //-you don't need to build rows you just bind the new ds to the gridview.
        //-when you get the first data on page load save the data into the cache or 
        //any state management variables.
    }

我希望这能有所帮助:)

@Paesmaker,该函数是在处理程序中编写的(正如我在上面的代码中提到的)。当我复制您编辑的代码时,它会给出错误,因为“名称\u缓存在当前上下文中不存在”,gridview id,tblUserDetail也会出错。什么是“缓存中以前数据的密钥”?“试用用户\u详细信息\u id”“?@Paesmaker,该函数是在处理程序中编写的(正如我在上面的代码中提到的)。当我复制您编辑的代码时,它会给出错误,因为“名称\u缓存在当前上下文中不存在”,gridview id,tblUserDetail也会出错。什么是“缓存中以前数据的键”?“试用用户\u详细信息\u id”?
private string PrepareDataSet(int LAST_TRIAL_USER_DETAIL_ID)
    {
        System.Data.SqlClient.SqlConnection conn = new SqlConnection("my connection string");
        string _cmdText = "Select TOP 10 TRIAL_USER_DETAIL_ID,Convert(Varchar,TRIAL_ACTIVATE_DATE,103) ActivateDate,TRIAL_CD_SERIAL_NO From TDSMAN_TRIAL_USER_DETAIL Where TRIAL_USER_DETAIL_ID >" + LAST_TRIAL_USER_DETAIL_ID;

        SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(_cmdText, conn);
        DataSet ds = new System.Data.DataSet();
        da.Fill(ds,  "User_Detail");

        //get the previous data from chche
        var parentDt = (DataSet)_cache["key For previous data in cache"];
        ds.Merge(parentDt);  
        tblUserDetail.DataSource = ds;
        tblUserDetail.DataBind();  

        //this when this function is in the page 
        //but if the function is in the handler you can return dataset to the page and //bind it to the tblUserDetail GridView like above

        //Notes:
        //-you don't need to build rows you just bind the new ds to the gridview.
        //-when you get the first data on page load save the data into the cache or 
        //any state management variables.
    }