Articles in this section
Category / Section

How to avoid PagingInfo takes add new record in it's record count in ASP.NET Web Forms GridGrouping?

1 min read

By design PagingInfo will take the add noid this we have to calculate it separately and modify the caption text using QueryCellStyleInfo event. Please refer the below code snippet which illustrates this:ew record into account. To av

C#

protected void GridGroupingControl2_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)

{

if (e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)

{

string str = e.Style.Text;

string[] parts = str.Split(new char[] { '(' });

string fpart = parts[0];

string spart = parts[1];

string[] parts2 = spart.Split(new char[] {' ' });

string p1 = parts2[0];

string p2 = parts2[1];

string p3 = parts2[2];

string p4 = parts2[3];

string p5 = parts2[4];

int num1 = Convert.ToInt32(p5);

num1=num1-1;

int num2 = Convert.ToInt32(p3);

if(num2 != 1)

num2=num2-1;

e.Style.Text =reccount.ToString()+" total"+" (Showing "+ num2.ToString()+"to"+ num1.ToString()+ ")";

}

}

VB

Protected Sub GridGroupingControl2_QueryCellStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs)

If e.TableCellIdentity.TableCellType = GridTableCellType.GroupCaptionCell Then

Dim str As String = e.Style.Text

Dim parts As String() = str.Split(New Char() { "("c })

Dim fpart As String = parts(0)

Dim spart As String = parts(1)

Dim parts2 As String() = spart.Split(New Char() {" "c })

Dim p1 As String = parts2(0)

Dim p2 As String = parts2(1)

Dim p3 As String = parts2(2)

Dim p4 As String = parts2(3)

Dim p5 As String = parts2(4)

Dim num1 As Integer = Convert.ToInt32(p5)

num1=num1-1

Dim num2 As Integer = Convert.ToInt32(p3)

If num2 <>1 Then

num2=num2-1

End If

e.Style.Text =reccount.ToString() & " total" & " (Showing " & num2.ToString() &"to"& num1.ToString() & ")"

End If

End Sub


Note:

A new version of Essential Studio for ASP.NET is available. Versions prior to the release of Essential Studio 2014, Volume 2 will now be referred to as a classic versions.The new ASP.NET suite is powered by Essential Studio for JavaScript providing client-side rendering of HTML 5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.

The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio for ASP.NET. Although Syncfusion will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls. If you have any queries or require clarifications, please let us know in the comments section below.

You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied