开发者

RadDataPager findcontrol returns null in some situation

hi my dear friends :

i have a radcombobox that is in relationship with RadListViw (with RadDataPager Inside)...

when i change the item of rad combobox , so RadListView is Updated...

selectedIndexxhanged() server-side event...

my selectedIndexChanged() is like this :

protected void RadcbImagesGroup_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
    rlvImages.DataBind();
    var raddatapager = (rlvImages).FindControl("RadDataPager1") 开发者_JS百科as RadDataPager;
    if (raddatapager != null)
    {
        raddatapager.FireCommand("Page","First");
    }

}

my radComboBox Item values is like : 1,2,3...

in mode 1 we have 25 pages... in mode 2 we have 5 pages... in mode 3 we have 5 pages...

my problem is when we are in mode 1 and put the pageNumber to more than 5 and when i change the combobox Item to mode 2 so

var raddatapager = (rlvImages).FindControl("RadDataPager1") as RadDataPager; is null...

but if we put the page# (we are in mode 1) to lower than 5 or equal 5 , and change the radcb item to another everything works fine...

where is the null problem?

thanks in advance


i could n't figure out what was the null problem ...
but the below code solved my issue by the other way :

 rlvImages.CurrentPageIndex = 0;

instead of :

var raddatapager = (rlvImages).FindControl("RadDataPager1") as RadDataPager;
if (raddatapager != null)
{
    raddatapager.FireCommand("Page","First");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜