Events from a custom control
-
I have a user control built with a checkbox list as part of it. It was built by someoneelse and i am just attempting to use it. I want to be able to handle the checkboxlist selectedindexchanged event when using the control as part of another webpage. Can someone help me as to how I should do this please? Its got me a little confused. I have set up a property to return the checkboxlist as an object but don't know how to set it up to get the event. i have snipped and edited down the whole control and it is detailed below. Sorry if its a lot of code but better that you have all the info. <%@ Control Language="VB" ClassName="ctlDropDownCheckBox" %> Protected Width As Long = 150 Public ReadOnly Property List() As CheckBoxList Get List = chkResults End Get End Property
">
" class="uiSelectBox" style="display:none;" onclick="javascript:<%= Me.ClientID %>_Update();" ondatabinding="javascript:alert('100');" >
Cheers Ian
-
I have a user control built with a checkbox list as part of it. It was built by someoneelse and i am just attempting to use it. I want to be able to handle the checkboxlist selectedindexchanged event when using the control as part of another webpage. Can someone help me as to how I should do this please? Its got me a little confused. I have set up a property to return the checkboxlist as an object but don't know how to set it up to get the event. i have snipped and edited down the whole control and it is detailed below. Sorry if its a lot of code but better that you have all the info. <%@ Control Language="VB" ClassName="ctlDropDownCheckBox" %> Protected Width As Long = 150 Public ReadOnly Property List() As CheckBoxList Get List = chkResults End Get End Property
">
" class="uiSelectBox" style="display:none;" onclick="javascript:<%= Me.ClientID %>_Update();" ondatabinding="javascript:alert('100');" >
Cheers Ian
You don't want to return the checkbox as a property. Use a delegate to define an event when the check changes, that you can then subscribe to in the containing page, and that gets called when the check changed gets called inside the control.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
You don't want to return the checkbox as a property. Use a delegate to define an event when the check changes, that you can then subscribe to in the containing page, and that gets called when the check changed gets called inside the control.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Thanks a ton Christian, You know when a solution is staring you right in the face and you can't see it!! :D Most of that I think was down to me using another person's control and attempting to make it work with what they had done...note to self...think outside the box :D Cheers Ian