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

[Solved] Aftre deleting record from grid.It shows "No record to display" Message

4 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ratndeep
Top achievements
Rank 1
Ratndeep asked on 22 Jun 2009, 10:23 AM
i am having a delete button in radgrid.My problem is that ,suppose there are
two pages in grid page 1 and 2. In page 2 there is a only one record so when i delete that record
from gird ,record gets deleted and i again bind grid on server side.so the grid now having only 1 page and it should show 
page 1 after deleting record on page 2 ( as page 2 had only 1 record)  but that is not happening ,it shows "No record to display" message. but when i refresh the page it display page 1 with record.I am not able to figure out the problem .
Plz help..

4 Answers, 1 is accepted

Sort by
0
lekha
Top achievements
Rank 1
answered on 22 Jun 2009, 01:13 PM
Use session datatable to bind the items in the radgrid. And delete items from the session table and then reset the datasourse.
Hope this may help you.

0
Princy
Top achievements
Rank 2
answered on 22 Jun 2009, 01:15 PM
Hello Ratndeep,

Which version of the grid control are you using? If you are using an older version, try upgrading to the latest version and see if this resolves the issue.

Another suggestion is to declaratively set the NoMasterRecordsText for the MasterTableView to empty and then check for the item count on the server and display the text as shown below:
aspx:
 <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" PageSize="5" AutoGenerateColumns="false" DataSourceID="Sqldatasource1"                 OnPreRender="RadGrid1_PreRender"
       <MasterTableView NoMasterRecordsText=""

c#:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        if (RadGrid1.Items.Count == 0) 
        { 
            RadGrid1.MasterTableView.NoMasterRecordsText = "No Records To Display"
        } 
    } 

Hope this helps:)
-Princy
0
Ratndeep
Top achievements
Rank 1
answered on 23 Jun 2009, 06:30 AM
Hi lekha
   Thanks for your post ,i am doing same as u have posted..From session records gets deleted but it stay on page 2
not moves to page 1 as there was only single record in  page 2..
0
Ratndeep
Top achievements
Rank 1
answered on 23 Jun 2009, 06:33 AM
Hi princy
  Working on your suggestion..
Tags
Grid
Asked by
Ratndeep
Top achievements
Rank 1
Answers by
lekha
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Ratndeep
Top achievements
Rank 1
Share this question
or