Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/334.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# PageIndexChanged不工作_C#_Telerik_Page Index Changed - Fatal编程技术网

C# PageIndexChanged不工作

C# PageIndexChanged不工作,c#,telerik,page-index-changed,C#,Telerik,Page Index Changed,我正在使用Radgrid和寻呼机。单击寻呼机上的下一页码时,数据未显示(未绑定数据)。有人能帮我修一下吗。这是我的密码 protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { Session["SearchRes"] = null; if (Session["TaskName"] != null)

我正在使用Radgrid和寻呼机。单击寻呼机上的下一页码时,数据未显示(未绑定数据)。有人能帮我修一下吗。这是我的密码

protected void Page_Load(object sender, EventArgs e)
{
    try
    {
        if (!IsPostBack)
        {
            Session["SearchRes"] = null;
            if (Session["TaskName"] != null)
                lblTskName.Text = Session["TaskName"].ToString();
            Session["FilColms"] = null;
            Session["SortExp"] = null;
            Session["FilExp"] = null;
            Session["ViewAll"] = null;
            BindGrid();
        }
    }
    catch (Exception ex)
    {
        throw ex;
    }
}

private void BindGrid()
{
    try
    {
        DataSet dsResult = new DataSet();

        clsSearch_BL clsObj = new clsSearch_BL();
        clsObj.TaskID = (string)Session["TaskID"];
        clsObj.CustName = (string)Session["CustName"];
        clsObj.MarketName = (string)Session["MarketName"];
        clsObj.HeadendName = (string)Session["HeadendName"];
        clsObj.SiteName = (string)Session["SiteName"];
        clsObj.TaskStatus = (string)Session["TaskStatus"];
        clsObj.OrdType = (string)Session["OrdType"];
        clsObj.OrdStatus = (string)Session["OrdStatus"];
        clsObj.ProName = (string)Session["ProName"];
        clsObj.LOC = (string)Session["LOC"];
        clsObj.QuoteID = (string)Session["QuoteID"];
        clsObj.CMNumber = (string)Session["CMNumber"];

        if (Session["SearchRes"] == null)
        {
            dsResult = clsObj.getSearchResults_BL(clsObj);
            Session["SearchRes"] = dsResult;
        }
        else
            dsResult = (DataSet)Session["SearchRes"];

        DataView dataView = dsResult.Tables[0].DefaultView;
        rg200.DataSource = dsResult;
        rg200.DataBind();
    }
    catch (Exception ex)
    {
        throw ex;
    }
}

protected void rg200_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{

    if (Session["TaskID"] != null)
    {
        string strTaskID = (string)Session["TaskID"];
        if (strTaskID != string.Empty)
        {
            clsTaskUpdates_BL objBL = new clsTaskUpdates_BL();

            GridEditableItem editedItem = e.Item as GridEditableItem;
            //Get the primary key value using the DataKeyValue.      
            string OrdID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["orderId"].ToString();
            //Access the textbox from the edit form template and store the values in string variables.

            string ClarifyAccountNbr = ((GridTextBoxColumnEditor)editedItem.EditManager.GetColumnEditor("Clarify Account Nbr")).TextBoxControl.Text;

            string SiteID = ((GridTextBoxColumnEditor)editedItem.EditManager.GetColumnEditor("Site ID")).TextBoxControl.Text;

            string QuoteID = ((GridTextBoxColumnEditor)editedItem.EditManager.GetColumnEditor("Quote ID")).TextBoxControl.Text;

            CheckBox chkEDP = ((GridCheckBoxColumnEditor)editedItem.EditManager.GetColumnEditor("EDP Created?")).CheckBoxControl;

            //string ClarifyAccountNbr = (editedItem["Clarify Account Nbr"].Controls[0] as TextBox).Text;
            //string SiteID = (editedItem["Site ID"].Controls[0] as TextBox).Text;
            //string QuoteID = (editedItem["Quote ID"].Controls[0] as TextBox).Text;
            //CheckBox chkEDP = (editedItem["EDP Created?"].Controls[0] as CheckBox);
            try
            {
                objBL.setTask200_Bl(OrdID, ClarifyAccountNbr, SiteID, QuoteID, chkEDP.Checked);
                Session["SearchRes"] = null;

                BindGrid();

            }
            catch (Exception ex)
            {
                rg200.Controls.Add(new LiteralControl("Unable to update Employee. Reason: " + ex.Message));
                e.Canceled = true;
            }
        }
    }
}
protected void rg200_PageIndexChanged(object source, GridPageChangedEventArgs e)
{
    try
    {
        rg200.CurrentPageIndex = e.NewPageIndex;
        BindGrid();
    }
    catch (Exception ex)
    {
        throw ex;
    }
}

您的代码显示您将绑定与DataBind()调用一起使用。通过这种方式,您应该手动更改页面索引挂钩PageIndexChanged,将数据源分配给网格并绑定它。或者,使用以节省一些手动编码