TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Danish Habib
NA
694
246.1k
Wrong checkbox index gatting
Jun 13 2015 6:09 AM
I have to take the checkboxIndex for that i have that below code but it shows wrong value on paging
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("LoggedInUserId") Is Nothing Then Server.Transfer("Login.aspx", True)
If Session("UserTypes") <> "6" Then
Server.Transfer("UnauthorizedAccess.aspx", True)
End If
Dim CheckBoxArray As ArrayList
If ViewState("CheckBoxArray") IsNot Nothing Then
CheckBoxArray = DirectCast(ViewState("CheckBoxArray"), ArrayList)
Else
CheckBoxArray = New ArrayList()
End If
If Me.Page.IsPostBack Then
Dim CheckBoxIndex As Integer
Dim CheckAllWasChecked As Boolean = False
Dim chkAll As CheckBox = DirectCast(grdTempDoctors.HeaderRow.Cells(0).FindControl("chkApprovedSelectAll"), CheckBox)
Dim checkAllIndex As String = "chkApprovedSelectAll-" & grdTempDoctors.PageIndex
If chkAll.Checked Then
If CheckBoxArray.IndexOf(checkAllIndex) = -1 Then
CheckBoxArray.Add(checkAllIndex)
End If
Else
If CheckBoxArray.IndexOf(checkAllIndex) <> -1 Then
CheckBoxArray.Remove(checkAllIndex)
CheckAllWasChecked = True
End If
End If
For i As Integer = 0 To grdTempDoctors.Rows.Count - 1
If grdTempDoctors.Rows(i).RowType = DataControlRowType.DataRow Then
Dim chk As CheckBox = _
DirectCast(grdTempDoctors.Rows(i).Cells(0) _
.FindControl("chkApproved"), CheckBox)
CheckBoxIndex = grdTempDoctors.PageSize * grdTempDoctors.PageIndex + (i + 1)
'If CheckBoxIndex >= 2 Then
' DisplayMessage(Me.Master.MessageBox, "More then one indicator is selected please select one indicator at a time !!.", "One indicator is permitted ", MessageBoxTypes.Warning)
' Return
'End If
If chk.Checked Then
If CheckBoxArray.IndexOf(CheckBoxIndex) = -1 And _
Not CheckAllWasChecked Then
CheckBoxArray.Add(CheckBoxIndex)
End If
Else
If CheckBoxArray.IndexOf(CheckBoxIndex) <> -1 Or _
CheckAllWasChecked Then
CheckBoxArray.Remove(CheckBoxIndex)
End If
End If
End If
Next
End If
ViewState("CheckBoxArray") = CheckBoxArray
Dim Records As String = Nothing
For Each Num In CheckBoxArray
Records = Records & Num & ","
Session("Records") = Records.TrimEnd(",")
Next
If Me.Page.IsPostBack Then
Return
End If
If Not IsFormInitialized() Then Return
DisplayInitialPage()
End Sub
I have attached a sheet with this question please check it I want to save the serial number comming with each record as shown in figure like 1,2,3,4,------ for that i am saving the checkboxindex instead of serial number but when i selecct question number 85 it save the 83 2 records back why???
Reply
Answers (
0
)
Error: The method or operation is not implemented. plz solve
Redirecting a page in asp.net.