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

Big blank space above header

8 Answers 281 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Dech
Top achievements
Rank 1
David Dech asked on 18 Aug 2009, 08:15 PM
Hi

I'm trying to fix some bug with my radgrid. I have some GridBoundColumn followed by one GridTemplateColumn with a regular Button in it. The button triggers a JavaScript function which shows a RadWindow as a popup.

My problem is when I click on the button, the RadWindow popup but also a big blank space appear in the RadGrid at top, above the header. The size of this space is about the same as the actual size of the rows shown under it.

This is most likely related to the fact that I want the grid to show an vertical scroll bar.

Anyway here is some code:

<telerik:RadGrid ID="RG_disponible" AlternatingItemStyle-HorizontalAlign="Center" 
                                        Width="550px" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" 
                                        runat="server" AllowSorting="true" HorizontalAlign="Center" AutoGenerateColumns="False" 
                                        OnItemDataBound="RG_disponible_ItemDataBound" OnSortCommand="RG_disponible_SortCommand" 
                                        OnItemCommand="RG_disponible_ItemCommand" OnDataBound="RG_disponible_DataBound"
                                        <ClientSettings> 
                                            <Resizing AllowColumnResize="false" /> 
                                            <Scrolling AllowScroll="true" UseStaticHeaders="false" /> 
                                        </ClientSettings> 
                                        <MasterTableView CommandItemDisplay="Top" TableLayout="Fixed" Width="532px" NoMasterRecordsText="Aucune photo ne correspond à la recherche"
                                            <CommandItemTemplate> 
                                                <div style="text-align: right;"
                                                    <asp:LinkButton ID="btnSelectAll" runat="server" CommandName="SelectAll" Text="Désélectionner tous"></asp:LinkButton> 
                                                </div> 
                                            </CommandItemTemplate> 
                                            <Columns> 
                                                <telerik:GridBoundColumn HeaderText="Numéro du rouleau" UniqueName="Numero_rouleau" 
                                                    DataField="RouleauNumero"
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridBoundColumn HeaderText="Numéro de la photo" UniqueName="Numero" DataField="PhotoNumero"
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridTemplateColumn UniqueName="ButtonColumn" HeaderText=""
                                                    <ItemTemplate> 
                                                        <asp:Button ID="I" runat="server" Text="Détails"/> 
                                                    </ItemTemplate> 
                                                </telerik:GridTemplateColumn> 
                                                <telerik:GridBoundColumn HeaderText="Numéro de la photo" UniqueName="Numero" Visible="false" 
                                                    DataField="PhotoNumero"
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridBoundColumn HeaderText="id photo" Visible="false" UniqueName="Id" DataField="Id"
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="" SortExpression="IsLink"
                                                    <ItemTemplate> 
                                                        <asp:CheckBox ID="choix" Enabled="false" runat="server" /> 
                                                    </ItemTemplate> 
                                                </telerik:GridTemplateColumn> 
                                                <telerik:GridBoundColumn HeaderText="" UniqueName="Id" DataField="EmprunteurId" Visible="false"
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridBoundColumn HeaderText="" UniqueName="CommandeId" DataField="CommandeId" 
                                                    Visible="false"
                                                </telerik:GridBoundColumn> 
                                            </Columns> 
                                        </MasterTableView> 
                                    </telerik:RadGrid> 
                                </ContentTemplate> 
                            </asp:UpdatePanel> 

As you can see, the reason why I kinda really need scrolling to work is because I can't use paging because of the CheckBox column. I don't see how i could get to save the rows which were checked after the page is changed. So when a button under the radgrid is clicked, I can access the RadGrid and retrieve the rows that are checked. If someone can tell me a way to do this, then I might as well drop the scrolling for paging and avoid the blank space issue.

This is what i have on the button with ID="I" which cause the problem. I do this in the itemdatabound event:

Button btn = dataItem["ButtonColumn"].FindControl("I") as Button;

btn.Attributes["onclick"] = string.Format("return ShowEditForm('{0}?{1}={2}','rwEmprunteurView');",
                "emprunteur_view.aspx", "commande_id", dataItem.Cells[11].Text);

btn.Attributes["onclick"] = string.Format("return ShowEditForm('{0}?{1}={2}','rwEmprunteurView');",
                "emprunteur_view.aspx", "commande_id", dataItem.Cells[11].Text);


With ShowEditForm being:
        function ShowEditForm(url, nomFenetre) {
            window.radopen(url, nomFenetre);
            return false;
        }

This is on IE 6. I tried in Firefox, and I dont get the white space.. But I need it to work on IE 6.

If you need more of my code, just ask.

Thanks










8 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 19 Aug 2009, 05:12 AM
Hello David,

Can you please remove HorizontalAlign="Center" and let me know about the result?

All the best,
Vlad
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
Princy
Top achievements
Rank 2
answered on 19 Aug 2009, 05:28 AM
Hi David,

You can also refer to the following help document, if you would want to persist the state of checkboxes in Template Columns, on grid operations like paging which rebinds the grid:
Persisting CheckBox control state in GridTemplateColumn on rebind

Thanks
Princy.
0
David Dech
Top achievements
Rank 1
answered on 19 Aug 2009, 01:01 PM
Wow thanks Vlad, removing it fixed the grid.

Thanks a lot
0
R
Top achievements
Rank 1
answered on 06 Dec 2011, 06:14 PM
I have a similar problem but changing or removing HorizontalAlign did not make a difference.
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1"
        GridLines="None" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
        AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False"
        OnItemCommand="RadGrid1_ItemCommand" Width="600px" Skin="Windows7"
        ShowStatusBar="True" AllowSorting="True" AllowFilteringByColumn="true">
 
        <%-- RC-8/10/11 --%>
        <ExportSettings HideStructureColumns="true" OpenInNewWindow="true" ExportOnlyData="true" IgnorePaging="true" />
        <%-- RC-8/10/11 END --%>
 
        <ItemStyle Height="30px" />
        <AlternatingItemStyle Height="30px" />
 
        <GroupingSettings CaseSensitive="false" />
 
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="GeneralAttr_ID"
            DataSourceID="SqlDataSource1" CommandItemDisplay="Top" Width="600px"
            HorizontalAlign="NotSet" EditMode="EditForms" GridLines="None" AllowFilteringByColumn="true">
 
            <%-- RC-8/10/11 --%>
            <CommandItemSettings ShowExportToPdfButton="true" ShowExportToWordButton="true" ShowExportToExcelButton="true"
                ShowExportToCsvButton="true" />
            <%-- RC-8/10/11 END --%>
 
            <%-- RC-11/7/11 --%>
            <EditFormSettings EditFormType="Template">
                <EditColumn UniqueName="EditCommandColumn1" />
                <PopUpSettings ScrollBars="None" />
 
                <FormTemplate>
                    <asp:PlaceHolder ID="phEditableControls" runat="server">
                        <table cellspacing="5" style="margin-left: 10px">
                            <tr>
                                <td>
                                    General Attribute:
                                </td>
                                <td>
                                    <telerik:RadTextBox ID="radTxtGenAttr" runat="server" Text='<%# Bind("GeneralAttr_Name") %>' ControlToValidate="radTxtGenAttr" onkeypress="return keyPress(this, event)" Height="10px" Width="160px">
                                    </telerik:RadTextBox>
                                    <asp:Label ID="LblErrMsg" runat="server" ForeColor="Red"></asp:Label>
                                </td>
                            </tr>
                     
                            <tr>
                                <td align="left" colspan="2">
                                    <asp:Button ID="btnInsert" Text="Insert"
                                        runat="server" CommandName="PerformInsert">
                                    </asp:Button
                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        CommandName="Cancel"></asp:Button>
                                </td>
                            </tr>
                        </table>
                    </asp:PlaceHolder>
                </FormTemplate>
            </EditFormSettings>
            <%-- RC-11/7/11 END --%>
 
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" Visible="false">
                                            <ItemStyle CssClass="MyImageButton" />
                                    </telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn DataField="GeneralAttr_ID" DataType="System.Int32"
                    HeaderText="GeneralAttr_ID" ReadOnly="True" SortExpression="GeneralAttr_ID"
                    UniqueName="GeneralAttr_ID" Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="GeneralAttr_Name"
                    HeaderText="General Attributes" SortExpression="GeneralAttr_Name" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                    UniqueName="GeneralAttr_Name" ColumnEditorID="GridTextBoxColumnEditor1" AllowFiltering="true" AllowSorting="true">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
 
        <PagerStyle Mode="NextPrevAndNumeric" />
    </telerik:RadGrid>

0
Pavlina
Telerik team
answered on 08 Dec 2011, 11:55 AM
Hello R,

I tried to replicate the described problem with the provided code, but to no avail. Please find attached my test page and let me know what is the difference in your case.

Greetings,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Anthony
Top achievements
Rank 1
answered on 30 Mar 2012, 02:37 PM
Hi

I'm having an issue with blank space as well... not exactly the same as the above... but it falls under the exact heading of the thread.
In VS design view you can see a blank space at the top of the grid, the also has blank space (height wise) and the pager drop down doesn't line up correctly.
I've looked at a number of threads and can't seem to find the solution. I've also played around with the code quite a bit - but to no avail.
Any suggestions? I'm assuming it's something simple that I'm missing...?

<telerik:RadGrid ID="RadGrid1" AllowMultiRowSelection="True" BackColor="Green"
        AllowMultiRowEdit="True" runat="server" AllowAutomaticDeletes="True"
        AllowAutomaticInserts="True" PageSize="20" AllowAutomaticUpdates="True" AllowPaging="True"
        AutoGenerateColumns="False" OnItemCreated="RadGrid1_ItemCreated"
        CellSpacing="0" GridLines="None" DataSourceID="DS1" ShowStatusBar="True"
        OnItemCommand="RadGrid1_ItemCommand"
        OnItemDataBound="RadGrid1_ItemDataBound" Skin="WebBlue"
        AllowSorting="True" CellPadding="0">
        <ClientSettings><Selecting AllowRowSelect="true" /></ClientSettings>
        <MasterTableView CommandItemDisplay="Top" DataKeyNames="user_id" DataSourceID="DS1EditMode="EditForms" AutoGenerateColumns="False" Width="100%">
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
        </EditFormSettings>
        <CommandItemTemplate>
            <div style="padding:10px 0px;">
                <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" CausesValidation="false" Visible='<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>'>
                         <img style="border:0px;vertical-align:middle" alt="Edit" src="images/icon_Edit.gif" /> Cancel editing</asp:LinkButton>
                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Add User" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'>
                         <img style="border:0px;vertical-align:middle;" alt="" src="images/icon_Edit.gif" /> Add new User</asp:LinkButton>
                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'>
                         <img style="border:0px;vertical-align:middle;" alt="" src="images/icon_Edit.gif" /> Add this User</asp:LinkButton>
                <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected user(s)?')" runat="server" CommandName="DeleteSelected" CausesValidation="false">
                         <img style="border:0px;vertical-align:middle;" alt="" src="images/icon_Delete.gif" /> Delete Selected User(s)</asp:LinkButton>
                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid">
                         <img style="border:0px;vertical-align:middle;" alt="" src="images/icon_Synch.gif" /> Refresh Users</asp:LinkButton>
            </div>
        </CommandItemTemplate>
        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
            <Columns>
            ...................................
            </Columns>
        </MasterTableView>
        <PagerStyle Mode="NextPrevAndNumeric"  />
    </telerik:RadGrid>

0
Eyup
Telerik team
answered on 30 Mar 2012, 03:51 PM
Hi David,

I have tried the provided code and everything was fine on my side.
Can you try adding this to your mark-up:
<MasterTableView  ... TableLayout="Fixed">
Probably the error is not inside RadGrid so if you have implemented tables, blocks, containers, etc. please check them thoroughly.

Regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Anthony
Top achievements
Rank 1
answered on 30 Mar 2012, 09:13 PM
Found the issue my side. I have padding added to certain div's in my external stylesheet. The RadGrid was then implementing this and adding it to it's display.

Tags
Grid
Asked by
David Dech
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Princy
Top achievements
Rank 2
David Dech
Top achievements
Rank 1
R
Top achievements
Rank 1
Pavlina
Telerik team
Anthony
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or