ERROR ON BINDING THE GRID WITH A LIST

Mark Devid

Total Post:102

Points:714
Posted by  Mark Devid
 968  View(s)
Ratings:
Rate this:

List<business.clspluginsprp> objprp = new List<business.clspluginsprp>();

business.clsplugins obj = new business.clsplugins();

for (Int32 i = 0; i < k.Length; i++)

{

   Int32 z = Convert.ToInt32(k.GetValue(i));

   objprp.Add(obj.fnd_plugins(z));

}

GridView2.DataSource = objprp;

GridView2.DataBind();

An error arrived which is as: 

The best overloaded method match for 'System.Collections.Generic.List.Add(business.clspluginsprp)' has some invalid arguments while the other error is : Argument 1: cannot convert from 'System.Collections.Generic.List' to 'business.clspluginsprp'

  1. Sumit Kesarwani

    Post:378

    Points:2694
    Re: Error on binding the grid with a list

    Hi Mark, 


    Try changing this:

    objprp.Add(obj.fnd_plugins(z));

    to this:

    objprp.AddRange(obj.fnd_plugins(z));

    Since it seems fnd_plugins returns a list in and of itself. This will also error if fnd_plugins does not return a List generic implementation. Posting the signature of fnd_plugins will help debug this.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!