New Message on dotNET User Group Hyd

checkbox in datagrid losting values..

Reply
  Reply to Sender   Recommend Message 1 in Discussion
From: pnagendra79

Hi,
    I took checkbox as a template in datagrid. And I added paging also to the grid. Problem here is when i check the values in 1st page and coming back from 2nd page, the checked items are losting their state. (mean checked items becoming unchecked). Plz tell me the solution... thanks in advance..
 
 
In the above image, when i goto 2nd page and click 1st page  the checked items are unchecking...
 
CODE

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Not IsPostBack Then

BindDataGrid("EmployeeID ASC")

End If

End Sub

 

Private Sub Dg_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles Dg.SortCommand

Dim arrSortExpr() As String

Dim i As Integer

If e.SortExpression = "" Then Return

BindDataGrid(e.SortExpression)

arrSortExpr = Split(e.SortExpression, " ")

For i = 0 To Dg.Columns().Count - 1

If (Dg.Columns(i).SortExpression = e.SortExpression) Then

If UCase(arrSortExpr(1)) = "ASC" Then

arrSortExpr(1) = "DESC"

ElseIf UCase(arrSortExpr(1)) = "DESC" Then

arrSortExpr(1) = "ASC"

End If

Dg.Columns(i).SortExpression = arrSortExpr(0) & " " & arrSortExpr(1)

Exit For

End If

Next

End Sub

Private Sub BindDataGrid(ByVal strSortField As String)

SqlDataAdapter1.Fill(DataSet11, "employees")

Dim dvemp As New DataView(DataSet11.Employees)

dvemp.Sort = strSortField

Dg.DataSource = dvemp

Dg.DataBind()

End Sub

 

Private Sub Dg_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles Dg.PageIndexChanged

Dg.CurrentPageIndex = e.NewPageIndex

BindDataGrid("")

End Sub

View Attachment(s)

View other groups in this category.


Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to