checkbox in datagrid losting values..
Reply
![]() |
|
|
From:
Roopesh
|
Hi Nagendra,
This is the default behaviour of the datagrids within the .net. I think you need to Click a button after selection of Check boxes, right?
If so, To solve this problem there are two ways
1. Display all the records as one shot without any paging (not recommended you might be having 100's of records).
2. Have a search functionality, based on the search display all the records at one shot, so the user can select the records for which he wants to update.
Regards
-Roopesh
From: "pnagendra79" <[EMAIL PROTECTED]> Reply-To: "dotNET User Group Hyd" <[email protected]> To: "dotNET User Group Hyd" <[email protected]> Subject: checkbox in datagrid losting values.. Date: Sat, 17 Jun 2006 06:27:17 -0700
<META content="Microsoft SafeHTML" name=Generator>
<STYLE>
ThmFgColumnHeader, A.FrameLink, A.HeaderLink, A.FooterLink, A.LgtCmd, A.MSNLink
{color:#FFFFFF;}
ThmFgTitleLightBk
{color:#FF6600;}
ThmFgSmallLight
{color:#ff0000;}
ThmFgNavLink, A.NavLink, A.ChildLink:hover
{color:#666699;}
ThmFgInactiveText, A.SystemLink
{color:#666666;}
ThmFgFrameTitle
{color:#FFFFCC;}
ThmFgMiscText, A.Cat, A.SubCat
{color:#336699;}
ThmFgCommand, A.Command, A.LargeCommand, A.MsgLink
{color:#003366;}
ThmFgHeader
{color:#333333;}
ThmFgDivider
{color:#CCCCCC;}
ThmBgStandard
{background-color:#FFFFFF;}
ThmBgUnknown1
{background-color:#FF6600;}
ThmBgFraming
{background-color:#666699;}
ThmBgUnknown2
{background-color:#666666;}
ThmBgHighlightDark
{background-color:#FFFFCC;}
ThmBgHighlightLight, #idToolbar, #tbContents
{background-color:#FFFFE8;}
ThmBgTitleDarkBk
{background-color:#F1F1F1;}
ThmBgAlternate
{background-color:#ECF1F6;}
ThmBgUnknown3
{background-color:#CCCCFF;}
ThmBgDivider
{background-color:#CCCCCC;}
ThmBgHeader
{background-color:#9999CC;}
ThmBgLinks
{background-color:#8696C9;}
ThmBgSharkBar
{background-color:#8696C9;}
ThmBgGlobalNick
{background-color:#9394A9;}
calfgndcolor
{color:#E00505;}
calbgndcolor
{color:#E00505;}
</STYLE>
checkbox in datagrid losting values..
Reply
|
|
| 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.
<STYLE>
ADMSmLnk
{font-family:verdana,system;color:#336699;text-decoration:none;}
ADMSmLnk:hover
{color:#ff6600;text-decoration:underline;}
</STYLE>
|
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.
|
|
|
View other groups in this category.
![]() |
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.
|
|