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

[Solved] Weird layout when ShowHeader=false

1 Answer 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 07 May 2009, 03:12 PM
I have a requirement from client to hide grid header when there is no record, but the insert edit form need to be shown up by default. Here is the code in PreRender event. The code does do the job, however, the insert edit form is shift to right dramatically and cut off part of it.  After study the run-time source code, I found out there is an empty table cell  before the insert edit form table. And same thing for "No record to display" message. Is there a way that insert edit form's colspan property can cover that empty table cell?
protected void rgDrugs_PreRender(object sender, EventArgs e) 
 { 
     int iCount = 0
        foreach(GridDataItem item in rgDrugs.Items) 
        { 
            if (item!=null) 
            { 
                iCount++; 
            } 
        } 
       if (iCount==0) 
       { 
           rgDrugs.ShowHeader = false
       }else 
       { 
           rgDrugs.ShowHeader = true
       } 
        if (rgDrugs.EditItems.Count>0) 
        { 
            rgDrugs.MasterTableView.IsItemInserted = false
        }else 
        { 
            rgDrugs.MasterTableView.IsItemInserted = true
        } 
        rgDrugs.MasterTableView.Rebind(); 

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 11 May 2009, 02:17 PM
Hello Anthony,

To achieve your goal you need to find the problematic table cell on the client-side and set its colSpan to the required value. You can achieve this, for instance, when pageLoad() event is raised. Note that the required cell could be in different place in the DOM depending on the rendered items in the grid.

Kind regards,
Georgi Krustev
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.
Tags
Grid
Asked by
Anthony
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or