Asp.Net GridView Control 1

Assalamualaykum Wr Br…today we explore the asp.net’s powerful control to display data as in tabular format with built-in Edit, Update, Cancel and Insert options, named as GRIDVIEW. The general syntax of markup is as shown:
<asp:GridView ID=”gridview1″ runat=”server”>
</asp:GridView>

This gridview will not display data because it has not datasource and databind method is called.

 

Pagination in Oracle 11g

Assalamualikum wr br.

Today we discuss about one requirement where data needs to be displayed in GridView from table abc which has more than 2,66,000  records. This was coded to fetch data using DataAdapter on page_load event later it was done pagination from memory using GridView pagination. Later it was reported that memory leakage encountered and pagination is not responding.

Hence it was suggested to retrieve data on demand which means based on page index of gridview, no. of records needs to be fetched from data table.

Also most interesting point is Oracle 11g is being used which does not support Fetch and Limit keywords.

Fetch is used to limit the result set  generated  from the query. Since we use 11g we need to modify the existing query  as below:

Select   *  from

(         Select  p.record_type,

p.reject_reason,

p.dealer_id,

p.dealer,

p.company,

p.country,

p.state,

p.pin,

rownum rm

from

(select   p.record_type,

p.reject_reason,

p.dealer_id,

p.dealer,

p.company,

p.country,

p.state,

p.pin

from  abc) p

where rownum <=   50 <max_limit>)

where rm >= 10  <min_limit>;

 

With the help of above modifications I can able to retrieve the records in table data between max_limit and min_limit. Otherwise the rownum would return from records 1 to specified constraint.

 

That’s all for the day.

Jazakallah khair..Happy Programming..:)