Sunday, March 11, 2012

ModalPopup clientside show on Button not Hyperlink

no matter what kind of button you use you can always just use the onClick event to call the popup. For modal popups i usually set the contorlID for the button to be a HiddenField. Then instead of using that popup control to show themodal popup i just write Click events for my button and inside put this...

ModalPopup1.Show();

This also lets you have more the 1 control open the same modal popup


Ah yes, the event handler for the click event has got me half way there. The only issue im running into now is the button causes a postback which is not needed.

The button is as follows.

<asp:ButtonID="showModalPopupButton"runat="server"Text="Show"onClientClick="showModalClick()"/>

The javascript is as follows:

function showModalClick(){var modalPopupBehavior = $find('ModalPopupBehavior');

modalPopupBehavior.show();

//return false;

}


Okay i got it, from the code behind i added.

showModalPopupButton.Attributes.Add("onclick","return false;")

No comments:

Post a Comment