Horizontal grid lines disappear in NULL cells

8 posts, 0 answers
  1. neebs
    neebs avatar
    106 posts
    Member since:
    Apr 2007

    Posted 20 Jul 2008 Link to this post

    This has been a problem for quite some time, not necessarily associated with RadControls for ASP.NET Ajax, but it still occurs in this latest version. Many of the skins provided display horizontal divider lines between rows. However if a cell displays a value which is NULL, the divider line does not appear for that cell only. This is especially noticeable if the row is selected. Is this a known issue?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Jul 2008 Link to this post

    Hi,

    Try the following code snippet in the PreRender event.

    CS:
    protected void RadGrid2_PreRender(object sender, EventArgs e)  
        {  
            foreach (GridDataItem dataItem in RadGrid2.Items)  
            {  
                foreach (GridColumn col in RadGrid2.Columns)  
                {  
                    if (dataItem[col.UniqueName].Text == string.Empty)  
                        dataItem[col.UniqueName].Text +=  " ";   
       
                }  
            }  
        }  


    Thanks
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. neebs
    neebs avatar
    106 posts
    Member since:
    Apr 2007

    Posted 22 Jul 2008 Link to this post

    This fixes the null columns at the expense of wiping out all my template columns.

    Steve
  5. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 22 Jul 2008 Link to this post

    Hi neebs,

    I think that the information from this forum thread will help you address the issue you are currently facing:

    http://www.telerik.com/community/forums/thread/b311D-bbcdct.aspx

    Best regards,
    Stephen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. neebs
    neebs avatar
    106 posts
    Member since:
    Apr 2007

    Posted 22 Jul 2008 Link to this post

    I'm still left with blanks in all my template columns using this technique. Is there any way to set the displayed element for template columns to  ?

    Steve
  7. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 22 Jul 2008 Link to this post

    Hello Steve,

    When using template columns, the easier way is to simply add   at the end of your item template and not do any checks at runtime.

    Best wishes,
    Dimo
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  8. neebs
    neebs avatar
    106 posts
    Member since:
    Apr 2007

    Posted 29 Jul 2008 Link to this post

    Hello,

    I have implemented the code provided as follows:

        protected void RadGridJobs_PreRender(object sender, EventArgs e) 
        { 
            foreach (GridDataItem dataItem in RadGridJobs.Items) 
            { 
                foreach (GridColumn col in RadGridJobs.Columns) 
                { 
                    if (col.ColumnType != "GridTemplateColumn") 
                    { 
                        if (dataItem[col.UniqueName].Text == string.Empty) 
                        { 
                            dataItem[col.UniqueName].Text = " "
                        } 
                    } 
                } 
            } 
        } 
     

    and it works, however as this is a master/detail grid view, a problem occurs when this is executed on the detail expansion. It fails with an exception because col.UniqueName is the name of a master table column, but it is iterating through the detail table. This causes the following message to appear:

    Cannot find a cell bound to column name 'Summary'

    where 'Summary' is the name of a master table column that doesn't exist in the detail table. I have looked for a way to determine whether the detail or master row is being rendered, but have not found anything. For now, I'll trap the exception, however I will need to apply the same logic to the detail table to prevent the missing grid lines.

    If you have a code snippet, I would appreciate it.

    Steve


  9. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 Jul 2008 Link to this post

    Hi neebs,

    Try setting the Name property for the Master table and Detail table and try the following code snippet to achieve the desired scenario.

    ASPX:
     <MasterTableView  CommandItemDisplay="Bottom" Name="Master" > 
             ..........  
              <DetailTables> 
                     <telerik:GridTableView runat="server" Name="Detail"  > 
                        .............  
                     


    CS:
    protected void RadGrid1_PreRender(object sender, EventArgs e)  
        {  
            foreach (GridDataItem dataItem in RadGrid1.Items)  
            {  
                if (dataItem.OwnerTableView.Name == "Master")  
                {  
                    foreach (GridColumn col in RadGrid1.Columns)  
                    {  
                        if (col.ColumnType != "GridTemplateColumn")  
                        {  
                            if (dataItem[col.UniqueName].Text == string.Empty)  
                            {  
                                dataItem[col.UniqueName].Text = "&nbsp;";  
                            }  
                        }  
                    }  
                }  
                else if (dataItem.OwnerTableView.Name == "Detail")  
                {  
                    foreach (GridColumn col in RadGrid1.MasterTableView.DetailTables[0].Columns)  
                    {  
                        if (col.ColumnType != "GridTemplateColumn")  
                        {  
                            if (dataItem[col.UniqueName].Text == string.Empty)  
                            {  
                                dataItem[col.UniqueName].Text = "&nbsp;";  
                            }  
                        }  
                    }  
                }  
            }   
        } 


    Regards
    Princy.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017