I have the following javascript:
<script type='text/javascript'> function showjQueryDialog() { $('#dialog').dialog('open'); } $(document).ready(function() { $('#dialog').dialog({ autoOpen: false, modal: true, buttons: { 'Renew Membership': function() { $(this).dialog('close'); } } }); }); </script>
I have an asp:Button on the page which logs the user it. This is the sample of what I want to occur when the button is clicked on the server-side:
protected void LoginButton_OnClick(object sender, EventArgs e) { UserProfile profile = UserProfile.GetUserProfile(txtUserName.Text); TimeSpan ts = profile.Expiration.Subtract(DateTime.Now); if(ts.Days <= 30) //call showJQueryDialog() to open the dialog box Page.ClientScript.RegisterStartupScript(typeof(Login2), 'showjquery', 'showJQueryDialog();', true); else //log the user in as normal. }
Also is how would I attach a method such as the following to the Renew Button on the Dialog
public void Renew() { Response.Redirect('Renew.aspx'); }
As calling client side function is not possible I would suggest to emit in javascript the information required for the decision and make everything happen on the client side.
Alternatively you can do need a page reload, as suggested from previous commenter.