Click here to Skip to main content
15,914,066 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionPaging in datagrid Pin
Nagraj Naik14-Jun-06 20:50
Nagraj Naik14-Jun-06 20:50 
AnswerRe: Paging in datagrid Pin
Suamal15-Jun-06 1:01
Suamal15-Jun-06 1:01 
GeneralRe: Paging in datagrid Pin
Nagraj Naik15-Jun-06 4:34
Nagraj Naik15-Jun-06 4:34 
GeneralRe: Paging in datagrid Pin
Suamal15-Jun-06 18:57
Suamal15-Jun-06 18:57 
GeneralRe: Paging in datagrid Pin
Nagraj Naik15-Jun-06 19:49
Nagraj Naik15-Jun-06 19:49 
GeneralRe: Paging in datagrid Pin
Suamal15-Jun-06 20:11
Suamal15-Jun-06 20:11 
GeneralRe: Paging in datagrid Pin
Nagraj Naik15-Jun-06 21:38
Nagraj Naik15-Jun-06 21:38 
GeneralRe: Paging in datagrid Pin
Suamal15-Jun-06 22:58
Suamal15-Jun-06 22:58 
Loop count of datagrid displays only the current page item count.
But in view state we can store all.

I will explain you how?

#Fill grid method()
1.Populate the grid (say 100 rows with 1 to 100 as ids)
clear viewstate

2.in first page select 2 checkboxes

3.In paging (to 2nd page)
add 2 ids to viewstate.
now it has 1,2.

while retriving
check for 1,2 ids in grid it will not be there.

4.In second page u select 3
add 3 ids with existing viewstate
now it has 1,2,11,12,13
while retriving
check for 1,2,11,12,13 ids in grid it will not be there.

5.goto 3rd page ,without selecting any ids.
now viewstate has 1,2,11,12,13

6.Return to 2nd page
now while retriving
check for 1,2,11,12,13 ids in grid 11,12,13 ids will be there.
If you change anything, you have to alter the viewstate.

# in maintain view

Private Function Maintain_View1()
Dim Arr As New ArrayList()
Dim gridItem As DataGridItem
If Not (ViewState("ID") Is System.DBNull.Value) Then
Arr = CType(ViewState("ID"), ArrayList)
End If
For Each gridItem In DataGrid1.Items
Dim chk As CheckBox = DirectCast(gridItem.FindControl("Status"), CheckBox)
Dim lbl As Label = DirectCast(gridItem.FindControl("ID"), Label)

//If already exists then, remove it from the list
If Arr.Contains(lbl.Text) Then
Arr.Remove();
End If

If chk.Checked Then
Arr.Add(lbl.Text)
End If
Next
ViewState("ID") = Arr
End Function


#call retrive view after fill GRid method


Sub Pageing_Routine(ByVal s As Object, ByVal e As DataGridPageChangedEventArgs)
DataGrid1.CurrentPageIndex = e.NewPageIndex
Maintain_View1()
Fillgrid()
Retrieve_Viewstate1()
End Sub
GeneralRe: Paging in datagrid Pin
Nagraj Naik15-Jun-06 23:22
Nagraj Naik15-Jun-06 23:22 
QuestionError : Page_Validators is undefined [modified] Pin
Praveen_S14-Jun-06 20:24
Praveen_S14-Jun-06 20:24 
AnswerRe: Error : Page_Validators is undefined Pin
minhpc_bk15-Jun-06 16:54
minhpc_bk15-Jun-06 16:54 
Questiondyamically generate 0 to n number of web charts within a templated control. Pin
uglyeyes14-Jun-06 19:47
uglyeyes14-Jun-06 19:47 
Questionsddfgfd Pin
surshbabuk14-Jun-06 19:44
surshbabuk14-Jun-06 19:44 
AnswerRe: sddfgfd Pin
_AK_14-Jun-06 20:18
_AK_14-Jun-06 20:18 
JokeRe: sddfgfd Pin
Guffa15-Jun-06 0:40
Guffa15-Jun-06 0:40 
GeneralRe: sddfgfd Pin
_AK_15-Jun-06 0:43
_AK_15-Jun-06 0:43 
Questionrename the file in vb.net Pin
amaneet14-Jun-06 19:36
amaneet14-Jun-06 19:36 
AnswerRe: rename the file in vb.net Pin
minhpc_bk14-Jun-06 20:02
minhpc_bk14-Jun-06 20:02 
Questiondraw graphs Pin
Najeed14-Jun-06 19:23
Najeed14-Jun-06 19:23 
AnswerRe: draw graphs Pin
amaneet14-Jun-06 19:29
amaneet14-Jun-06 19:29 
Questionbitmap class in vb.net Pin
amaneet14-Jun-06 19:20
amaneet14-Jun-06 19:20 
QuestionReading Contents of a Word File. Pin
deepaks314-Jun-06 19:15
deepaks314-Jun-06 19:15 
AnswerRe: Reading Contents of a Word File. Pin
amaneet14-Jun-06 19:22
amaneet14-Jun-06 19:22 
GeneralRe: Reading Contents of a Word File. Pin
deepaks314-Jun-06 19:41
deepaks314-Jun-06 19:41 
QuestionMultiline Datagrid Control [modified] Pin
Nagraj Naik14-Jun-06 19:11
Nagraj Naik14-Jun-06 19:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.