Jump to content
Software FX Community

Only show added items?


Recommended Posts

I'm sure this is pretty easy once the documentation and examples are completed but at the moment it is somewhat confusing.  Here's the issue, I have a datasource that is created from an ArrayList which comes from a third party Webservice. The webservice returns null or default entries when it is called.  Now when I pull data and then add the columns as shown below.  I still get the rest of the columns that I really do not want to show.  Is there anyway to simply have an empty grid to start except for Grid1.Fields.Add items? I was able to do this by binding the dataset and then turning off columns but then I would have to create a pretty robust sort. In that scenerio I was unable to convert a url field into an image field easily.  Code listed below

This works great but lists all the data elements after the added ones.

  Media[] objects = myClient.Service.getMedia(template, query, sort, range);

  ObjectArray objectArray = new ObjectArray(objects);

  DataSet ds = new DataSet();

  ds = objectArray.ToDataSet();

  Grid1.DataSource = ds;



  GridFX.WebForms.TextField media_idField = new GridFX.WebForms.TextField();

  GridFX.WebForms.ImageField imageField = new GridFX.WebForms.ImageField();

  GridFX.WebForms.TextField titleField = new GridFX.WebForms.TextField();

  GridFX.WebForms.TextField authorField = new GridFX.WebForms.TextField();

  GridFX.WebForms.TextField lengthField = new GridFX.WebForms.TextField();

  GridFX.WebForms.TextField ratingField = new GridFX.WebForms.TextField();

  titleField.DataPath = "title";

  imageField.DataPath = "thumbnailURL";

  authorField.DataPath = "author";

  lengthField.DataPath = "length";

  ratingField.DataPath = "rating";

  media_idField.DataPath = "media_id";







 This Works better by hiding elements but of course then they have to be sorted and I was not able to get Grid1.Fields.Add to work nor could I change a column to work with an imageField.

Media[] objects = myClient.Service.getMedia(template, query, sort, range);

  ObjectArray objectArray = new ObjectArray(objects);

  DataSet ds = new DataSet();

  ds = objectArray.ToDataSet();



  Grid1.DataSource = ds;


int[] cols = { 1, 6, 11, 25, 27, 38, 40, 42, 43 };



Thanks for any help just to get us going as I understand this is still beta.

Link to comment
Share on other sites

Interesting.  The problem seems to come from clearing the Fields and Columns and then adding and re-binding.  I have logged it as an issue and it will be addressed in a future build.

An easy workaround to your problem is to add the fields and columns in the ASP markup, either through the markup directly or through the property grid.  The resulting grid markup would look something like this:

  <GridFX:Grid ID="Grid1" runat="server" >


  <GridFX:TextField DataPath="title"></GridFX:TextField>

  <GridFX:ImageField DataPath="thumbnailURL"></GridFX:ImageField>

  <GridFX:TextField DataPath="author"></GridFX:TextField>

  <GridFX:TextField DataPath="length"></GridFX:TextField>

  <GridFX:TextField DataPath="rating"></GridFX:TextField>

  <GridFX:TextField DataPath="media_id"></GridFX:TextField>



  <GridFX:FieldColumn Field="title"></GridFX:FieldColumn>

  <GridFX:FieldColumn Field="thumbnailURL"></GridFX:FieldColumn>

  <GridFX:FieldColumn Field="author"></GridFX:FieldColumn>

  <GridFX:FieldColumn Field="length"></GridFX:FieldColumn>

  <GridFX:FieldColumn Field="rating"></GridFX:FieldColumn>

  <GridFX:FieldColumn Field="media_id"></GridFX:FieldColumn>



Also, I would recommend using the ObjectDataSource to hook up to your data.  Was there a specific reason you were doing everything in code? 

Thanks so much.  I hope to hear back soon.

Steve Potter

Link to comment
Share on other sites

Thank you for your response. Wow, I love the markup...we are free.  Thanks again! I look forward to the new updates. As for the object dataset, we have not found an easy way to pass in the out of band authentication. The MyClient part. 

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...