Home > DeveloperSection > Forums > Error on binding the grid with a list
Mark Devid
Mark Devid

Total Post:101

Points:707
Posted on    August-26-2014 2:33 AM

 ASP.Net
Ratings:


 1 Reply(s)
 675  View(s)
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'



Sumit Kesarwani

Total Post:378

Points:2694
Posted on    August-26-2014 5:01 AM

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.


Don't want to miss updates? Please click the below button!

Follow MindStick