Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > DataGrid Checkbox column CheckedChange event not fired

Reply
Thread Tools

DataGrid Checkbox column CheckedChange event not fired

 
 
Raymond
Guest
Posts: n/a
 
      10-19-2003
Hi all,

I created a custom datagrid control which dynamically
adding checkbox in item template column

In the item template class, it contains a custom event
handler for checkedchange event for checkbox. For some
reason, this event only raised when the checkbox is
selected. When un-checking the checkbox, this event do not
fired.

Please let me know if you've seen this kind of problem
before and give me some suggestion for troublshooting.

thanks in advance!

 
Reply With Quote
 
 
 
 
Oliver
Guest
Posts: n/a
 
      10-22-2003
Hi Raymond,

Could you show us the code that is giving you trouble? Is autopostback set to
true each time you create the control?


"Raymond" <(E-Mail Removed)> wrote in message
news:05ee01c3965d$5c2f6240$(E-Mail Removed)...
Hi all,

I created a custom datagrid control which dynamically
adding checkbox in item template column

In the item template class, it contains a custom event
handler for checkedchange event for checkbox. For some
reason, this event only raised when the checkbox is
selected. When un-checking the checkbox, this event do not
fired.

Please let me know if you've seen this kind of problem
before and give me some suggestion for troublshooting.

thanks in advance!


 
Reply With Quote
 
 
 
 
Raymond Law
Guest
Posts: n/a
 
      10-24-2003
Hi Oliver,

Thanks for your reply. Please see the following section of the code.

Pulbic class MyDataGrid
inherits DataGrid
:
:
:
:
:


Public Class MyItemTemplate
Implements ITemplate

Private colID As String

Public sSelectItem As String
Sub New(ByVal str As String)
colID = str
End Sub


Public Overridable Overloads Sub InstantiateIn(ByVal
container As Control) Implements ITemplate.InstantiateIn
oCheckBox = New CusCheckBox()
oCheckBox.EnableViewState = True
oCheckBox.Enabled = True
oCheckBox.AutoPostBack = True
AddHandler oCheckBox.CheckedChanged, AddressOf
CheckChangedHandler



container.Controls.Add(oCheckBox)
End Sub


Public Sub CheckChangedHandler(ByVal sender As Object, ByVal
e As EventArgs)
Dim oCheckBox2 As CheckBox = CType(sender, CheckBox)
If oCheckBox2.Checked Then
sItems += oCheckBox2.ChkVal
Else
'Removing the items from sItems (a session variable)
End If
End Sub
End Class



Public Class CusCheckBox
Inherits CheckBox
Dim _ChkVal As String

Public Property ChkVal() As String

Get
Return _ChkVal
End Get

Set(ByVal Value As String)
_ChkVal = Value
End Set

End Property
End Class
End Class







*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedded <divs> with events: How to prevent the parent div's eventfrom being fired when the embedded div's event is fired? Num GG Javascript 2 11-17-2008 08:56 PM
DataGrid SortCommand Event not fired on dynamically generated datagrid biru ASP .Net Web Controls 2 05-06-2005 01:38 PM
determine CheckBox's checkedChange status dynamically? =?Utf-8?B?ZGF2aWQ=?= ASP .Net 4 05-04-2005 02:10 PM
how do i access a dropdownlists selected value in a datagrid edititemtemplate column from the selectedindexchanged event of another dropdownlist in a datagrid edititemtemplate column Dave M ASP .Net Datagrid Control 0 12-14-2004 11:53 AM
radio button CheckedChange event Kelly ASP .Net Web Controls 1 11-12-2004 10:30 PM



Advertisments