Hello,
My page has a server side panel that is hidden when the page loaded, checkboxes inside of the datagrid, and buttons. If at least one checkbox is not clicked and the user click on the button, I show the panel. When the user click on one of the checkbox, I want to hide the panel. Onclick on the checkbox I already have a cleint function to change the row color.
I don't want to use __doPostBack. Don't want to do postback.
My question are:
How do I either have checkbox onclick called both client and server side functions.
Or have the client side function call the server side function to hide the panel.Thank you
![]() |
0 |
![]() |
Hi Kathy -
If you have a Panel with the ID of pnlError, and a CheckBox with the id of chkRow, you could use the following logic (in the Page Load event)
I'm assuming VB, let me know if you need C#
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
chkRow.Attributes.Add("onClick", "document.getElementById('" & pnlError.ClientID & "').style.display='none';")
End Sub
To show the panel, use style.display='';
![]() |
0 |
![]() |
Tyler,
Thank you for the tip. It works, but..
I already have the onClick atttributes added for client side for something else. Can I have the OnClick doing more than one?
' add on click to each checkbox
' chkSelect.Attributes.Add("OnClick", "javascript:colorRow(event)")chkSelect.Attributes.Add("onClick", "document.getElementById('" & ErrorMessage.ClientID & "').style.display='none';")
Thanks again
![]() |
0 |
![]() |
kathy9999 wrote:
I already have the onClick atttributes added for client side for something else. Can I have the OnClick doing more than one?
Sure you can. Just seperate the statements using a semicolon.
chkSelect.Attributes.Add("onclick", string.Format("colorRow(event);document.getElementById('{0}').style.display='none';", ErrorMessage.ClientID))
--
Tarjei
![]() |
0 |
![]() |
It works.
Thank you so much for the code. You saved me hours of research time.
![]() |
0 |
![]() |