This is a migrated thread and some comments may be shown as answers.

Multiple Radgrids width to fit to screen page

12 Answers 388 Views
Grid
This is a migrated thread and some comments may be shown as answers.
LiZ0r
Top achievements
Rank 1
LiZ0r asked on 30 Apr 2009, 04:10 AM
So I figured out how to have multiple radgrids and allow them to export to one page, which is great!
But I have an issue, I need the grids to fit on the screen of the web browser and they aren't.
I have two radgrids, one that has two columns and another that has about 10+ columns underneath. They are both within a radgrid, when I try to reduce the width nothing works, I have a scroll bar on the bottom the of browser which I don't want. The width of both radgrids are at 100% but the grid extends the screen to double instead of 100% being the screen itself, therefore not working properly.
Is there any way to have the scroll bar on one of the radgrids and not both? I have tried the Client Settings with Scrolling and it's working but I have 4 columns missing. I have also provided some code:

Can I get some help?

12 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 05 May 2009, 11:07 AM

Hello LiZ0r,

Thank you for the detailed explanation. Can you please check whether setting TableLayout =Fixed for the MasterTableView of the nested grids produces the desired effect? Note that by default the TableLayout is set to Auto and this may cause the grid to expand when having many columns in it.
 
You may also set fixed width through the embedded grids tags to see whether this makes a difference.

Best regards,

Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
LiZ0r
Top achievements
Rank 1
answered on 07 May 2009, 04:44 AM
Thanks for that, the use of TableLayOut = Fixed  fixed my radgrid.

Also wondering, is there a reason why, when no data is avaliable, the radgrid doesn't show all columns.
Is there anyway to fix that?
0
Sebastian
Telerik team
answered on 07 May 2009, 07:20 AM
Hello LiZ0r,

The grid should show all column headers by default when there is no data available and the NoRecords template is displayed. Simply verify that the ShowHeadersWhenNoRecords property of the master table is set to true (this is its default value).

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
LiZ0r
Top achievements
Rank 1
answered on 08 May 2009, 12:44 AM
I have set ShowHeadersWhenNoRecords to true in the MasterTableView but it still only shows 8 columns out of 10....
Not sure why that is though....

I also have another problem that has occurred.
In one of my radgrids that is in another grid, the footer is not showing up with all the sums that I have created.
why is that? how do I fix that?
0
Sebastian
Telerik team
answered on 08 May 2009, 11:36 AM
Hello LiZ0r,

Can you please paste the markup/code-behind of your page (using the 'Format code block' dialog at the top right corner of the forums editor) and provide a live url where the discrepancies can be observed? Thus I will do my best to provide up-to-the-point explanation/fix.

Regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
LiZ0r
Top achievements
Rank 1
answered on 11 May 2009, 12:54 AM

Thanks for help!

I don't have a live URL that I can provide that doesn't require username and passwords.
Can you see if the code helps but if you need more detail let me know! Thanks again!
0
Sebastian
Telerik team
answered on 11 May 2009, 11:59 AM
Hi LiZ0r,

I reviewed your code snippets and noticed that the bound column with unique name "AirlineNameForExport" has Display = false setting which will hide it in the grid when rendered and exclude it from the exported document. Additionally, the hyperlink inside the first template column in the second grid will be stripped when you choose ExportOnlyData = true.

Can these details be related to the reason for the abnormality you observed?  Note that you can use the tips from this section of the documentation (paragraph 'Exporting GridButtonColumn/GridTemplateColumn/GridHyperLinkColumn data') to display these columns when needed.

Concerning the missing footers:
Can you please share with us how you generate the footer aggregate values? I suppose you calculate them dynamically since you do not seem to use the declarative footer aggregates supported by our web grid. Do you use the programmatic approach from here for this purpose? I will appreciate if you elaborate a bit more on this subject and which values are missing from the footer in order to research the matter additional and provide more definite explanation/solution.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
LiZ0r
Top achievements
Rank 1
answered on 12 May 2009, 01:24 AM

Hi Sebastian,

 

First I wanna start off by saying thank you for helping me with my problem.

I have the bound column as "AirlineNameForExport" Display = false because I was hoping for the hyperlink to be shown on the radgrid, but when exported to have just the column name. I had the following to lines in the code behind page: 

 

RadGrid2.MasterTableView.Columns.FindByUniqueName("AirlineName").Display = false;

 

 

RadGrid2.MasterTableView.Columns.FindByUniqueName("AirlineNameForExport").Display = true;

 

But was receiving an error advising that RadGrod2 doesn't exist, and I think this is because it is nested in another grid.
How would I go around this so that I am able to export those columns? I'm not sure if this is the reason for the observed abnormality but I removed it for now because it wasn't working properly.

The missing footers, I managed to fix by setting ShowFooter="True" which show the sum of each column.
I forgot to put in this line, but now that it is in the footers are able to be viewed. 

 

Another problem I am having is that,when I set the width to be 100% I expect to be the size of the page, but it will stretch over and then there will be a horinzontal toolbar on the browser, is this because I have too many columns? Also, I am having difficulties export to PDF or Excel, it just won't export like it should....

0
Accepted
Sebastian
Telerik team
answered on 14 May 2009, 01:35 PM
Hello LiZ0r,

To locate the second nested grid and display its hidden column/replace the hyperlink column with hidden GridBoundColumn before the export operation takes place, you can use this code inside the LinkButton2's OnClick server handler:

foreach(GridDataItem dataItem in RadGrid0.MasterTableView.Items)  
{  
  (dataItem.FindControl("RadGrid2"as RadGrid).MasterTableView.Columns.FindByUniqueName("AirlineName").Display = false;  
  (dataItem.FindControl("RadGrid2"as RadGrid).MasterTableView.Columns.FindByUniqueName("AirlineNameForExport").Display = true;   
  //show or hide other columns in the same manner  
}  
 

How to set the grid to fit the height of the browser window you can see from the sample project in this code library entry:

http://www.telerik.com/community/code-library/aspnet-ajax/grid/setting-100-height-and-resize-on-container-resize-for-grid-with-scrolling-and-static-headers.aspx

How to customize the exported document appearance you can find out from the information in these resources:

http://www.telerik.com/help/aspnet-ajax/grdexport.html
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/pdfexport/defaultcs.aspx

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Maruti Rao
Top achievements
Rank 1
answered on 29 Oct 2009, 11:36 AM
Hi Lizor

My requirement is that to have a web page like below and i need to export to PDF as it is, as per your comment you achieved this, can you please help me the how to do.

Sno Class & subject Marks
Class Subject 
1      
2      
3    
Total marks 0
Grade A
Result Pass
Sno Cource offered Fee discount
1    
2    
3    
Total Disc 40%
Total Pay 0
0
LiZ0r
Top achievements
Rank 1
answered on 30 Oct 2009, 12:16 AM
Hi Maruti,

I'll be glad to help.
Have you coded this yet? What problems are you having?
You may want to take a look at creating radgrids to input your data and then I can give you a hand where you are having problems.

Regards,
LiZ0r
0
Anil Nautiyal
Top achievements
Rank 1
answered on 25 Apr 2012, 10:52 AM
Hello Sebastian
same problem occurred with my rad grid.i have rad grid which have around 50 columns.when i print my grid, grid's columns are truncated.
i set GridTableLayout to auto but it is not working.
Please help me.

thanks & regards
Anil Nautiyal
Tags
Grid
Asked by
LiZ0r
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
LiZ0r
Top achievements
Rank 1
Maruti Rao
Top achievements
Rank 1
Anil Nautiyal
Top achievements
Rank 1
Share this question
or