btech_Saurabh 0 Light Poster

Hi.....

I am binding a Repeater control with List<int> at OnLoad event

protected override void  OnLoad(EventArgs e)
{
      if(!Page.IsPostBack)
      {
           List<int> datasource =Get();
           if(datasource!=null)
           {
                  rpt.DataSource=datasource;
                  rpt.DataBind();
           }
      }

      base.OnLoad(e);
}

it works fine.....my Repeater bind successfully......i have a button at each Repeater Item....When i click on that button my Repeater Item Command is fire ......but my code e.Item.DataItem is null

protected void rpt_ItemCommand(object source, RepeaterCommandEventArgs e)
{
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    if (e.CommandName == "Remove")
                    {
int i=(int)e.Item.DataItem // This Line shows error (my ItemDataBound event is working fine.....)
                        
                     }
                }
}