We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Displaying Images in GridListControl Columns

Hello, I can display an Image in my GridListControl by setting the "ImageColumn" and "ImageList" properties, but how can I display an image in more than one column? For example, I need to display a GridListControl with three columns; an Image, some text data, and then another image. How can I do this? Thanks... Dave

9 Replies

AD Administrator Syncfusion Team June 26, 2006 04:01 PM UTC

Hi Dave, This can be achieved by handling the PrepareViewStyleInfo event of the GridListControl and assigning the respective imagelist. The following sample demonstrates this process. Sample : GridListControl_Image_Multicolumn Thanks and regards, Madhan


DA Dave June 27, 2006 04:53 PM UTC

Hello - This ZIP file contains no files....please help. Thanks. Dave >Hello, > >I can display an Image in my GridListControl by setting the "ImageColumn" and "ImageList" properties, but how can I display an image in more than one column? For example, I need to display a GridListControl with three columns; an Image, some text data, and then another image. How can I do this? > >Thanks... >Dave


DA Dave June 27, 2006 04:55 PM UTC

Madhan, This ZIP file contains no files....please help. Thanks. Dave >Hi Dave, > >This can be achieved by handling the PrepareViewStyleInfo event of the GridListControl and assigning the respective imagelist. The following sample demonstrates this process. > >Sample : GridListControl_Image_Multicolumn > >Thanks and regards, >Madhan >


AD Administrator Syncfusion Team June 27, 2006 05:22 PM UTC

Hi Dave, Sorry for the inconvenience. Here is the link for the sample. http://www.syncfusion.com/Support/user/uploads/GridListControl_Image_Multicolumn_4bcde661.zip Thanks, Madhan


DA Dave June 28, 2006 11:55 PM UTC

Thanks Madhan, that works great. One last question - is there any reason why a DataTable has to be used for the GridListControl ''DataSource'' property? Is there any way an ArrayList could be used in your example? Thanks again. Dave >Hi Dave, > >Sorry for the inconvenience. Here is the link for the sample. > >http://www.syncfusion.com/Support/user/uploads/GridListControl_Image_Multicolumn_4bcde661.zip > >Thanks, >Madhan >


AD Administrator Syncfusion Team June 29, 2006 12:22 AM UTC

Hi Dave, You can have datasource as ArrayList as similar to a datatable. Kindly refer to the following code snippet for details. +++++++++++++++++++++++++++++++++++++++ public class Form1 : System.Windows.Forms.Form { =========== ========== private void Form1_Load(object sender, System.EventArgs e) { =========== ========== this.gridListControl1.DataSource = GetArrayList();//GetParentTable(); this.gridListControl1.DisplayMember = "ID"; this.gridListControl1.ValueMember = "ID"; this.gridListControl1.MultiColumn = true; } private ArrayList GetArrayList() { ArrayList array = new ArrayList(); array.Add(new MyArrayClass(null,"Name1",null)); ===== ==== return array; } } public class MyArrayClass { private string id, name, address; public MyArrayClass(string id,string name,string address) { this.id = id; this.name = name; this.address = address; } public string ID { get { return id; } set { id = value; } } ==== ====== } +++++++++++++++++++++++++++++++++++++++ Best regards, Madhan


DA Dave June 30, 2006 12:30 AM UTC

Hi again Madhan, Your example is kind of working for me - my question is, by setting the ''DisplayMember'' to the "ID" of that class, what does that do? Also, how do you know which fields within a class are going to display in the GridList? I still am trying to get ONLY four fields from my class to display in four columns: Id, ICON, Name, ICON2. The problem seems to be that I have several data members/fields in my (display) object, and others are getting populated in the columns. Thanks again, Dave Busch >Hi Dave, > >You can have datasource as ArrayList as similar to a datatable. Kindly refer to the following code snippet for details. > >+++++++++++++++++++++++++++++++++++++++ >public class Form1 : System.Windows.Forms.Form >{ >=========== >========== >private void Form1_Load(object sender, System.EventArgs e) >{ >=========== >========== > this.gridListControl1.DataSource = GetArrayList();//GetParentTable(); > this.gridListControl1.DisplayMember = "ID"; > this.gridListControl1.ValueMember = "ID"; > this.gridListControl1.MultiColumn = true; >} >private ArrayList GetArrayList() >{ > ArrayList array = new ArrayList(); > array.Add(new MyArrayClass(null,"Name1",null)); >===== >==== > return array; >} >} > >public class MyArrayClass >{ >private string id, name, address; >public MyArrayClass(string id,string name,string address) >{ > this.id = id; > this.name = name; > this.address = address; >} >public string ID >{ > get > { > return id; > } > set > { > id = value; > } >} >==== >====== >} >+++++++++++++++++++++++++++++++++++++++ > >Best regards, >Madhan >


AD Administrator Syncfusion Team June 30, 2006 01:42 AM UTC

Hi Dave, The Display and Value member will be helpful in displaying and retrieving the required column values, when we have the gridListControl as a dropdown in the grid. In this case, you can cancel it. The grid will display as in the datasource, so to display the required columns you can hide the unnecessary columns in the grid. Sample : http://www.syncfusion.com/Support/user/uploads/GridListControl_Image_Multicolumn_63b4d1b7.zip Best regards, Madhan


DA Dave June 30, 2006 03:08 AM UTC

Thanks for all of your prompt responses! I''ll take a look at your example :) >Hi Dave, > >The Display and Value member will be helpful in displaying and retrieving the required column values, when we have the gridListControl as a dropdown in the grid. In this case, you can cancel it. The grid will display as in the datasource, so to display the required columns you can hide the unnecessary columns in the grid. > >Sample : http://www.syncfusion.com/Support/user/uploads/GridListControl_Image_Multicolumn_63b4d1b7.zip > >Best regards, >Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon