GridView Custom Paging in ASP.NET 3.5 with SQL Server Stored Procedure

GridView Custom Paging in ASP.NET 3.5 with SQL Server Stored Procedure

GridView — Displays a set of data items in an HTML table. ASP.NET GridView control enables you to display, sort, page, select, and edit data.

Default gridview paging works best when you deal with limited pages. If there are more pages then, the performance suffers. In this case direct jump to desire page is a good alternative.

I have deal with a problem on GridView while working on user control (.ascx). I have a user control (.ascx) with GridView in it. I have used Stored Procedure to retrieve data. Bounding data to gridview display all the records and Default paging setting not work for me. Here Custom Paging helps me and only those database records that need to be displayed get retrieved. Using GridView Custom Paging solve the Issue for me.

Continue reading “GridView Custom Paging in ASP.NET 3.5 with SQL Server Stored Procedure”

Finding Last line in the text using regular expressions with .net

Finding Last line in the text using regular expressions with .net

In this regular expressions, we are going to find last line in the text.

Regular Expression Pattern

.+Z$

A description of the regular expression:

Any character, one or more repetitions
End of string or before new line at end of string
End of line or string

How It Works

This regular expression will check for Any character, one or more repetitions of End of string or before new line at end of string.

Continue reading “Finding Last line in the text using regular expressions with .net”

Finding First line in the text using regular expressions with .net

Finding First line in the text using regular expressions with .net

In this regular expressions, we are going to find first line in the text.

Regular Expression Pattern

\A.*

A description of the regular expression:

Beginning of string
Any character, any number of repetitions

How It Works

This regular expression will check for Beginning of line followed by Any character.

Continue reading “Finding First line in the text using regular expressions with .net”

Finding each line in the text using regular expressions with .net

Finding each line in the text using regular expressions with .net

In this regular expressions, we are going to find each line in the text.

Regular Expression Pattern

^.*$

A description of the regular expression:

Beginning of line or string
Any character, any number of repetitions
End of line or strin

Sucessful Matches

This is a test.
What you want?
That’s great!
as shown below:

Continue reading “Finding each line in the text using regular expressions with .net”

Finding Sentence using regular expressions with .net

Finding Sentence using regular expressions with .net

In the field of linguistics, a sentence —an expression in natural language— is often defined to indicate a grammatical and lexical unit consisting of one or more words that represent distinct concepts. A sentence can include words grouped meaningfully to express a statement, question, exclamation, request or command.

All the sentences contins group of words ending with .(punctuation mark), ?(question mark), !(exclamation mark) or : (colon) etc. In this regular expression we are going to find out sentences, means group of words ending with .(punctuation mark), ?(question mark), !(exclamation mark) or : (colon) etc.

Regular Expression Pattern

(?sx-m)[^\r\n].*?(?:(?:\.|\?|!|\:)\s)

A description of the regular expression:

Change options within the enclosing group [sx-m]
Turn OFF Multiline option
Turn ON Single Line option
Turn ON Ignore Pattern Whitespace option
Any character that is NOT in this class: [\r\n]
Any character, any number of repetitions, as few as possible
Match expression but don’t capture it. [(?:\.|\?|!|\:)\s]
(?:\.|\?|!|\:)\s
Match expression but don’t capture it. [\.|\?|!|\:]
Select from 4 alternatives
Literal .
Literal ?
!
Literal :
Whitespace

Continue reading “Finding Sentence using regular expressions with .net”