I am trying to create three buttons. ButtonAdd adds a new introduction screen and opens an editor in a new window to make changes to said screen. Button1 is only visible if the user has not yet added an introduction screen. ButtonRemove removes the introduction screen. ButtonEdit opens the editor to make changes to the intro screen. ButtonRemove and ButtonEdit are only visible if the user has already added the intro screen. The problem I am having is with ButtonAdd.
ButtonAdd needs to make a server call in order to actually create the object and save it in the database:
serverClickFunction(object sender, EventArgs e)
{
activity.addIntroScreen();
}
ButtonAdd also needs to make a client call in order to open the editor. The URL that opens the editor needs to know certain information about the new object (screenid and contentid):
function OpenEditIntro() {
var tviewer = window.open('../library/edit.aspx?&ScreenID=<%#
this.introScreenID %>&contentID=<%# this.introContentID%>')
tviewer.focus();
}
So essentially the server call needs to be made first. OR else the client call doesn't know what to use for screenID or contentID. So I tried to call the client function from the server or code behind. Like so:
serverClickFunction(object sender, EventArgs e)
{
activity.addIntroScreen();
ScriptManager.RegisterStartupScript(this, this.GetType(),
"openEdit", "OpenEditIntro();", true);
}
This worked superbly. Except that popup blockers did not like this. So they wouldn't allow the edit window to popup. Is there any way of getting around this popup being blocked? Or is there anothe approach to this problem that I am just not considering?