3

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") 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

SilverLight
  • 19,668
  • 65
  • 192
  • 300
  • That is really odd - the pager should always be present. Unless you have number of items in the listview which is accommodated in one page only and pager is not rendered. Can this very case be the culprit of the null reference? – Dick Lampard May 19 '11 at 13:44
  • thanks @Dick Lampard for answer ... yes this is really odd ... i am confused about that! can u test this issue in a simple project and let us to know the resaults? – SilverLight May 19 '11 at 17:46

1 Answers1

0

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");
}
SilverLight
  • 19,668
  • 65
  • 192
  • 300