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

Radgrid: Pager does not getting refreshed on item deletion..

7 Answers 229 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Rekha
Top achievements
Rank 1
Rekha asked on 23 Dec 2008, 11:24 AM

Hello,

I am using DeleteCommand of radGrid to delete items from grid. Item gets removed on deletion but paging does not getting refreshed. Initailally my grid was containing 2 pages. I deleted all items from second page, still pager shows 2 page count.

Here is the code,

<

 

telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True"

 

 

AllowSorting="True" AutoGenerateColumns="False" GridLines="Vertical" OnNeedDataSource="RadGrid1_NeedDataSource"

 

 

OnItemDataBound="RadGrid1_ItemDataBound" Skin="WebBlue" AllowMultiRowEdit="True"

 

 

OnDeleteCommand="RadGrid1_DeleteCommand" OnUpdateCommand="RadGrid1_UpdateCommand"

 

 

OnItemCreated="RadGrid1_ItemCreated" Width="1200px" AutoGenerateEditColumn="True"

 

 

OnItemCommand="RadGrid1_ItemCommand" AllowMultiRowSelection="True" AutoGenerateDeleteColumn="True"

 

 

PageSize="22" AllowAutomaticDeletes="True" OnPageIndexChanged="RadGrid1_PageIndexChanged">

 

 

<ExportSettings ExportOnlyData="True" IgnorePaging="True" OpenInNewWindow="True">

 

 

 

<Pdf AllowAdd="false" AllowCopy="true" AllowModify="true" AllowPrinting="true" Author="Anonymous"

 

 

Keywords="None" PageBottomMargin="1in" PageLeftMargin="10px" PageRightMargin="10px"

 

 

PageTopMargin="1in" PageTitle="Admin Report" Subject="RadGrid Export" Title="RadGrid export"

 

 

PaperSize="A4" PageWidth="800px" />

 

 

</ExportSettings>

 

 

<PagerStyle HorizontalAlign="Left" Mode="Slider" />

 

 

<MasterTableView DataKeyNames="Fadder_ID,Referance_Id">

 

 

<RowIndicatorColumn Visible="False">

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</RowIndicatorColumn>

 

 

<ExpandCollapseColumn Visible="False" Resizable="False">

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</ExpandCollapseColumn>

 

 

<Columns>

 

 

<telerik:GridTemplateColumn UniqueName="Template1" HeaderText="ID" AllowFiltering="false">

 

 

<HeaderStyle HorizontalAlign="Center" Width="20px" />

 

 

<ItemTemplate>

 

<%# this.RadGrid1.CurrentPageIndex * this.RadGrid1.PageSize + Container.ItemIndex + 1%>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridBoundColumn DataField="Name" HeaderText="Avsender" UniqueName="FedderName"

 

 

ReadOnly="True">

 

 

<HeaderStyle HorizontalAlign="Center" Width="150px" />

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

</telerik:GridBoundColumn>

 

</

 

Columns>

 

 

 

 

 

<EditFormSettings>

 

 

 

 

 

<PopUpSettings ScrollBars="None"></PopUpSettings>

 

 

 

 

 

</EditFormSettings>

 

 

 

 

 

</MasterTableView>

 

 

 

 

 

<GroupingSettings CaseSensitive="False" />

 

 

 

 

 

</telerik:RadGrid>

 

7 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 29 Dec 2008, 10:56 AM
Hi Rekha,

Can you please also provide the code to populate the grid with data, as well as the code, which is used to actually delete a record?

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rekha
Top achievements
Rank 1
answered on 01 Jan 2009, 09:23 AM

 

 

protected

 

void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

 

{

bindbride();

}

 

public void bindbride()

 

{

strConnection =

ConfigurationSettings.AppSettings["MyConnection"];

 

 

SqlConnection sqlConn;

 

 

SqlCommand sqlCmdComapany;

 

sqlConn =

new SqlConnection(strConnection);

 

 

string query = @"SELECT Fadder_Master.Fadder_ID, Fadder_Master.Name, Fadder_Master.Fadder_number, Fadder_Master.Mail_Id,

 

Fadder_Master.Aktive_Status,Fadder_Master.Comments, Referance.Referance_Id,

Referance.Fadder_number AS Fadder_number, Referance.Referred_name, Referance.Referred_mail,

Referance.Aktive_Status AS Aktive_Status, Bilde.BildeName,

Refered_mail_login =

Case when Refered_mail_login = 1 then 'Confirmed'

when Refered_mail_login = 0 then 'Unconfirmed' END

FROM Fadder_Master LEFT OUTER JOIN

Bilde ON Fadder_Master.Fadder_ID = Bilde.Fadder_ID RIGHT OUTER JOIN

Referance ON Fadder_Master.Fadder_ID = Referance.Fadder_number

WHERE (Referance.Aktive_Status = 0)

group by Fadder_Master.Fadder_ID,Fadder_Master.Name, Fadder_Master.Fadder_number, Fadder_Master.Mail_Id,

Fadder_Master.Aktive_Status,Fadder_Master.Comments, Referance.Referance_Id,Referance.Fadder_number,

Referance.Referred_name, Referance.Referred_mail,

Referance.Aktive_Status, Bilde.BildeName,Referance.Refered_mail_login

ORDER BY Fadder_Master.Name"

 

;

 

 

SqlConnection myConnection = new SqlConnection(strConnection);

 

 

SqlDataAdapter ad = new SqlDataAdapter(query, myConnection);

 

ds =

new DataSet();

 

ad.Fill(ds,

"Categories");

 

RadGrid1.DataSource = ds;

SetRelavantFilters(RadGrid1);

Label1.Text =

"";

 

Label1.Text =

" Totalt resultat: " + "<b>" + ds.Tables[0].Rows.Count.ToString() + "</b>";

 

 

if(ds.Tables[0].Rows.Count>0)

 

{

LinkButton1.Enabled =

true;

 

LinkButton2.Enabled =

true;

 

}

 

else

 

 

 

 

{

LinkButton1.Enabled =

false;

 

LinkButton2.Enabled =

false;

 

}

}

 

protected

 

void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e)

 

{

 

GridEditableItem editedItem = e.Item as GridEditableItem;

 

 

string Fadder_ID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["Fadder_ID"].ToString();

 

 

string Referance_Id = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["Referance_Id"].ToString();

 

strConnection =

ConfigurationSettings.AppSettings["MyConnection"];

 

 

SqlConnection sqlConn;

 

 

SqlCommand sqlCmdParticipants, sqlCmdComapany = null;

 

sqlConn =

new SqlConnection(strConnection);

 

 

string Command = "update Referance set Aktive_status = 1 where Referance_Id='" + Referance_Id + "'";

 

sqlCmdComapany =

new SqlCommand(Command, sqlConn);

 

sqlConn.Open();

sqlCmdComapany.ExecuteNonQuery();

sqlCmdComapany.Dispose();

sqlConn.Close();

}

0
Rekha
Top achievements
Rank 1
answered on 01 Jan 2009, 09:40 AM
One of my collegue is also facing problem in pager refreshing:

http://cid-a38ba1c013b5d908.skydrive.live.com/self.aspx/ForForum/screen%20snaps%20for%20pager%20problem.JPG

Above link is the snapshot of following problem description.
Page is having 5 option button where we are displaying the radgid ibt the radajaxpannel on clicking on the SHOW button. Here at firt time the pageer in footer of the RadGrid show appropriate values but if we change the option button on the top to fetch the next report and when clicking on the SHOW buttton the data and the internal count on the table for row come ok, but the Previous result of the paging is displayed on the Radgrid.

This above Problem observed  when the records of the search is higher than the previous less record the higher figure remain in the Paging though the next display result is having the less count of rows. Also if the next result is carring higher rows count then it will get display in the paging.
Note:
1. in some option result we are hiding and displaying the columns by visiable property.
2. Is this the problem due to the Pannel is not full portback or any thing else.
3. Also internally we are using static datatable but the dat in the table comes on though we are passing the Rows count to a custom usercontrol on top of the grid to display.

0
Yavor
Telerik team
answered on 07 Jan 2009, 06:25 AM
Hello Rekha,

I reviewed the code, and it looks correct.
At this point, if the issue persists, please open a formal support ticket, where you can attach files, and send us a small working project, which demonstrates your logic, as well as the unwanted behavior.
I will debug it locally, and get back to you with additional information.

Sincerely yours,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Pravin
Top achievements
Rank 1
answered on 01 Jan 2010, 12:25 PM
Hi Rekha

Did you get any solution for this problem

http://cid-a38ba1c013b5d908.skydrive.live.com/self.aspx/ForForum/screen%20snaps%20for%20pager%20problem.JPG

I am facing the same problem.Please help its urgent.
0
Yosief
Top achievements
Rank 2
answered on 18 Aug 2010, 12:35 PM

Hello Ivor

I have a similar problem to Rekha's where the paging of a RadGrid is not refreshing. If, for example, the first search returns 15 records and the second search 5 records, I see '... page 1 of 2...' in the second search which is incorrect info caused by the paging section of the grid not refreshing.

Please help as soon as possible. Thank you!
Yosief Kesete
0
Iana Tsolova
Telerik team
answered on 20 Aug 2010, 03:02 PM
Hi Yosief,

Can you confirm that the delete procedure finished properly in your case?
Also, are you using custom paging? Any additional information on your setup might help us to find the source of the problem in your case.

Greetings,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Dock
Asked by
Rekha
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Rekha
Top achievements
Rank 1
Pravin
Top achievements
Rank 1
Yosief
Top achievements
Rank 2
Iana Tsolova
Telerik team
Share this question
or