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

Problem with grid width after postback

4 Answers 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 07 Jul 2011, 11:20 AM
Hi,

in our project we have problem with grid width: on page load it's ok, here's piece of markup from page source:
<div tabIndex="0" class="RadGrid RadGrid_GreenSF FullWidth" id="ctl00_cphMain_tc1_ctl00_contentArea_ctl00_ctl01_gridClient" _events="[object Object]" control="[object Object]" EmptyDataText="No data" CommandItemDisplay="Top" jQuery1605439695548107272="158">

but after postback it looks like this:

<div tabIndex="0" class="RadGrid RadGrid_GreenSF FullWidth" id="ctl00_cphMain_tc1_ctl00_contentArea_ctl00_ctl01_gridClient" style="width: 682px;" _events="[object Object]" control="[object Object]" EmptyDataText="No data" CommandItemDisplay="Top" jQuery1608745933755360553="158">

I have no idea where this inline style came from, I have not set width for the grid.

As a result, grid occupies not whole width, as FullWidth (width: 100%) prescribes, but instead some part of the page :(

What could be wrong here?

p.s. There is nothing especial with postback, the only note: postback happens from parent page and the grid is situated in iframe page.

4 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 13 Jul 2011, 07:34 AM
Hello Alexander,

Do you resize the columns before the post-back? Did you try to set width of the grid to 100% explicitly?

Greetings,
Vasil
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Alexander
Top achievements
Rank 1
answered on 14 Jul 2011, 12:37 PM
Hi,
I do not use any width setting for my columns. As to grid width, here is markup from skin file, that relates to this grid
(to solve the problem, I had to add method to OnLoad:
function setFullWidthHeightReally100Percent() {
    $('.FullWidth').css('width', '');
    $('.FullHeight').css('height', '');
}

). But if you find the reason of error of adding inline style - please, let me know here! :)

<b4restore:B4GridClient runat="server" SkinID="b4GridClient" PageSize="100" MasterTableView-PageSize="100"
    EmptyDataText="No data" Skin="GreenSF" EnableEmbeddedSkins="false"
    MasterTableView-NoMasterRecordsText="No data" MasterTableView-Width="100%"
    PagerStyle-PrevPageText="" PagerStyle-NextPageText="" PagerStyle-ShowPagerText="true" PagerStyle-Mode="NextPrevAndNumeric"
    MasterTableView-AllowMultiColumnSorting="False"
    CssClass="FullWidth" PagerStyle-AlwaysVisible="true" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="False" CommandItemDisplay="Top">
</b4restore:B4GridClient>
0
Vasil
Telerik team
answered on 14 Jul 2011, 03:21 PM
Hello Alexander,

I am glad that you have solved the issue.

We are still not sure why exactly you had such a problem. There are many scenarios that will cause the grid to have inline style applied, but it will be also initially applied and not only after a post-back. Additionally you could try to set explicitly width of the grid to 100%, and it should be used even after the post-back.

Regards,
Vasil
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Alexander
Top achievements
Rank 1
answered on 14 Jul 2011, 06:10 PM
Hi, when I set width 100% as inline style initially - anyway it gets override with fixed pixel width after postback... :(

So far, I will have to use my solution...
Tags
Grid
Asked by
Alexander
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Alexander
Top achievements
Rank 1
Share this question
or