Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert the ClientID of a div into an OnClientClick event

In the XHTML for a page I have:-

<asp:Button ID="bookNowButton" runat="server" CssClass="bookNowButton"
            OnClientClick="showHideLoggedInDiv('<%=bookingFormDiv.ClientID%>')" />

This breaks. I need the correct syntax or method to insert the bookingFormDiv.ClientID into the control.

What needs to be done?

like image 998
Craig Avatar asked May 26 '10 14:05

Craig


1 Answers

You can set the attribute from code behind:

bookNowButton.OnClientClick = "showHideLoggedInDiv('" + bookingFormDiv.ClientID + "')"
like image 110
Guffa Avatar answered Oct 17 '22 08:10

Guffa