Jump to content
Software FX Community

How to print data in Grid.


KodgireVijay
 Share

Recommended Posts

Having a printing functionality within Grid FX is going to take a while to implement it. Thus, for the time being Grid FX doesn't support printing.

Now, copying all data to the clipboard feature is something easier to implement and we are already working to have it shortly. We can notify you as soon as is ready for you to test it.

Thank you very much for your feedback.

 

Link to comment
Share on other sites

  • 4 months later...

We are currently using GridFX in our production environment and are pretty happy with it. I'm wondering if there is an estimated release date for the PRINT functionality? This is something we would definitely like to see on GridFX and would be using for our future development projects.

 

Thanks

MG 

Link to comment
Share on other sites

Hi, the latest service pack of Grid FX has printing functionality.  There's a print button in the toolbar now.  You can download the latest service pack at http://support.softwarefx.com/ProductBase.aspx?Product=GridFX10

I'd love to hear your feedback on the new print functionality.  Check it out and please let us know.  Thanks for using Grid FX!

Link to comment
Share on other sites

This is great news! We will be saving quite a bit of dev time not having to implement a custom print function for the grid.

 I installed the new service pack and have it working beautifully in my dev environment. However, I'm having some issues on certain screens, where VS is throwing me XHTML vaidation errors preventing me from switching to Design mode. This only came up after I install the new service pack.

This a sample error message. There are quite a few of these showing up for any given screen with the grid on it. :

Error 1 Cannot switch views: Content is not allowed between the opening and closing tags for element 'Selection'. D:\XMAPS\Source\XMAPS_ASP_Web\RMFS\Dialogs\rmf_dlg_notes_main.aspx 89 14 D:\...\XMAPS_ASP_Web\

Error 2 Validation (XHTML 1.0 Transitional): This name contains uppercase characters, which is not allowed. D:\XMAPS\Source\XMAPS_ASP_Web\RMFS\Dialogs\rmf_dlg_notes_main.aspx 90 24 D:\...\XMAPS_ASP_Web\

In this particualr case it doesnt seem to like the <Style> tag inside the <Selection> tags (or inside any other markup tags):

<

Selection ChangeAction="ClientOnly">

<Style CssClass="gridFx-selection" />

</Selection>

As soon as  I remove the <Style> tag, it lets me swtich to Design mode.

Why does this happen?  Again, this only happens AFTER I installed the service pack. Is there a workaround/fix for this, as we already have several screens in production that are using the <Style> tag under other markup tags.

Thanks again for a great product and for your help on this.

Madusha.

Link to comment
Share on other sites

Glad to hear it worked out for you.  For VS 2008, we had to change the way the Style properties are serialized.  VS 2008 has problems serializing complex inner properties named "Style".  So, we changed it so the style properties are serialized as attributes.

In your case, you just change the code to:

<Selection ChangeAction="ClientOnly" Style-CssClass="gridFx-selection" />

That shoudl work fine.  We are sorry this causes a problem but we were forced to do it.

Thanks!

Link to comment
Share on other sites

Great, that did the trick! I just removed the <style> tag and reset it in Designer which set it correctly in the markup.

 I've run into another issue when trying to print all pages in the grid. I get a "There was an error in the callback error message", and the following is the exception that I receive when debugging :

Exception type: System.InvalidOperationException

Message: GridNotes's DataSource was null although settings indicate it should be used.  Handle Grid GridNotes's DataSourceSelecting event and set the e.DataSource property in the event handler.

Stack Trace:   at GridFX.WebForms.Grid.a(DataSourceSelectingEventArgs A_0)

at GridFX.WebForms.Grid.c(DataSourceSelectingEventArgs A_0)

at GridFX.WebForms.Grid.bl()

at GridFX.WebForms.GridCommands.g(ParameterlessCommandArgs A_0)

at GridFX.WebForms.Command`1.b(TArgs A_0)

at GridFX.WebForms.Command`1.a(CommandArgs A_0)

at GridFX.WebForms.Grid.a(String A_0, o9 A_1)

at GridFX.WebForms.Grid.k(String A_0)

FYI : In case it is helpful, the way we are sourcing the data to the grid is by setting its DataSource property to a DataView object returned by the business layer at runtime. Any help on troubleshooting this issue is much appreciated. If you need more information please let me know.

Thanks

Madusha

Link to comment
Share on other sites

Madusha,

Glad to hear the design time problems were fixed.  The exception you encounter now can be easily fixed by handling the Grid.DataSourceSelecting event, which is new in the latest service pack.  I'll explain the reason below, but first the fix.  The easiest way is to load the grid at design time, open the smart tags, and in the Choose Data Source dropdown, choose the "<In Code>" option.  This will automatically create the event handler.  In the handler, you just set the e.DataSource property to the same value from your business layer you used before.  You should then remove the existing code that sets the grid's data source. 

Now for the reason why (if you are interested).  Traditionally, the DataSource of the grid was set in the DataBinding event or somewhere.  This worked fine because the only time Grid needed the data source was during data binding, when it created the items it needed to show.  However, since we introduced Copy and Print functionality, and because we offered the ability to copy the entire data source, the grid now needed to get the data for those situations in addition to during data binding.  Since sometimes people use database paging, and since grouping is ignored during copy/print, the DataSource property cannot be relied upon to be accurate for Databinding, copying, and pasting:  hence the parameters in the event args of the DataSourceSelecting event.

There is one other huge reason that alone justifies the event: timing.  When you change the page, sort, group, etc, the grid needs to run its data binding.  If you set the DataSource too late, the grid cannot bind because it has no data source.  Other situations give rise to odd behavior.  Like if you set teh DataSource during Loading, but then the user deletes, inserts, or updates, the data source will not be refreshed.  Additionally, in that case, if the grid doesn't need to bind but a DataSource is supplied, the data retrieval is wasted. 

The right way to set the grid's data source is using a pull model.  That way the data source is provided only when needed and is guaranteed to be accurate.  Hence the DataSourceSelecting event.  I realize it's a departure from the convention, but this is the only way to ensure your application runs smoothly in all cases.  Although it is not widespread knowledge, setting the GridView's DataSource property in code is very error prone.  We do not intend to let our users experience that kind of frustration, even if it involves a bit different model.  I hope you understand.

In any case, it has been made very easy to set the data source in code.  Just follow the wizard and you'll be good to go.  Remember to remove the code that sets Grid.DataSource.  It will no longer be necessary.

Link to comment
Share on other sites

Hey Stephen,

 Its working like a charm now! Thanks for the quick solution and the detailed rationale on why this had to be implemented this way.

So it seems like we dont have to implement the OnDataBinding event at all, but can simply put all our data source handling logic inside this OnDataSourceSelecting event. Simple experimentation leads me to believe that the grid works fine this way, but is this recommended practice?

 Also, will the DataBind method become obsolete in a future release of GridFX and become unsupported? I hope this will not be the case as we would have to refactor a lot of our code that we are already using in production.

Thanks again for all your help.

Madusha

 

Link to comment
Share on other sites

Great, glad to hear!  You are correct that you don't need to handle the DataBinding event at all.  I recommend the DataSourceSelecting for all your data source fetching. No, we do not plan on making calling DataBind to be obsolete.  However, it may become unused eventually.  However, it will be a long long time until we make any breaking changes.  Our incremental service pack approach to updating grid does not allow for breaking changes.  So feel confident knowing your code will not break.  Thanks again for everything.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...