Problem When No records exists

6 posts, 1 answers
  1. VS
    VS avatar
    101 posts
    Member since:
    Jul 2008

    Posted 28 May 2009 Link to this post

    Hi,

    I have a grid which displays No Records text when no record exists for the grid. It works fine.
    But for certain conditions, i dont want to display that message at all. I was successfull in that as well by using as below

    Grid1.MasterTableView.NoMasterRecordsText =

    "";
    But i can see the row line displayed in this case. How can i avoid the row lines being displayed in the grid when that conditions occurs.

    Regards

    Sujith

     

  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 28 May 2009 Link to this post

    Hello Sujith,

    I guess you want to hide the extra line for ro record item when there is no records to display in grid. If so you can try out the following code.

    CS:
     
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
    {  
        if (e.Item.ItemType == GridItemType.NoRecordsItem)  
        {  
            e.Item.Visible = false;  
        }   

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. VS
    VS avatar
    101 posts
    Member since:
    Jul 2008

    Posted 28 May 2009 Link to this post

    Thanks Princy.
    That was perfect
  5. Karen
    Karen avatar
    27 posts
    Member since:
    Jul 2008

    Posted 31 May 2009 Link to this post

    Hello Princy

    I have a similar problem, however in my case e.Item.ItemType is never GridItemType.NoRecordsItem  I have debugged and it seems only header footer and pager item types are created when no records to display.
    Any suggestions?
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Jun 2009 Link to this post

    Hi Karen,

    Are you checking for the NoRecordsItem in the ItemDataBound event? The above given code will work fine in the ItemCreated event. You may also try accessing it in the PreRender event.

    CS:
     
     protected void RadGrid1_PreRender(object sender, EventArgs e) 
        { 
            foreach (GridNoRecordsItem item in RadGrid1.MasterTableView.GetItems(GridItemType.NoRecordsItem)) 
            {  
             
            } 
       } 


    Regards
    Shinu
  7. Karen
    Karen avatar
    27 posts
    Member since:
    Jul 2008

    Posted 01 Jun 2009 Link to this post

    Thanks for your reply Shinu, but this doesn't work either, I tried both ItemCreated and ItemBound events non of them has any NoRecordsItem items, neither PreRender has, this looks realy weired.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017