Problem with grid width after postback

5 posts, 0 answers
  1. Alexander
    Alexander avatar
    152 posts
    Member since:
    Jun 2012

    Posted 07 Jul 2011 Link to this post

    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.
  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 13 Jul 2011 Link to this post

    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!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Alexander
    Alexander avatar
    152 posts
    Member since:
    Jun 2012

    Posted 14 Jul 2011 Link to this post

    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>
  5. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 14 Jul 2011 Link to this post

    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!

  6. Alexander
    Alexander avatar
    152 posts
    Member since:
    Jun 2012

    Posted 14 Jul 2011 Link to this post

    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...
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017