Showing posts with label multiple. Show all posts
Showing posts with label multiple. Show all posts

Wednesday, March 28, 2012

Modal popup extender and multiple dropdownlists

Hi,

My requirement is that-On a panel,which acts as modal pup up extender,I have multipledropdownlists(cascading),so on selecting one,an autopostback happens,and then the modal pop up disappears.How can I handle,autopostbacksfrom modalpopup so that,the popup does not disappear.

In general, wrapping content in an UpdatePanel is the way to hide the postback of that content. ModalPopup allows UpdatePanels to be within the popup content, so that should work here, too.

Monday, March 26, 2012

Modal Popup Extender with multiple TargetControlID?

Hello, I'm new to the toolkit and I'm looking for ideas to accomplish a somewhat trivial goal.

What I want is to show a panel in modal form base on the item chosen on a list.

Imagine a list of employees and you want that when the user clicks on one of them a modal window comes up and allows the user to edit the chosen employee's data.

the problem is that the ModalPopupExtender has room just for a single TargetControlID.

Does anyone know a way to accomplish this?


TIA

Yes I beleive you are correct in that the ModalPopupExtender allows only one TargetControlID, however you can have multiple ModalPopupExtenders on a page if you need multiple (different) Panels for input.

If you need only one Modal and want to show it from many different events you can create a button which will be shown as visible inline but on Page Load set the visibility to none and set it as your TargetControlID. Then in any events you need the modal simply call ModalPopupExtender.show() method with 'ModalPopupExtender' being the ID of your extender. The reason I say to leave the visibility set to true inline is I recently read a post where the Events were not getting attached at run time in some cases unless they were set to visible at compile time. If you take a look at the Sample code for the toolkit they have an example of this scenario. Also keep in mind you might want to call the hide() method on the ModalPopupExtender when your finished with Input as some never get disposed and might cause problems next time you try to show one.

Hope this helps...

Wednesday, March 21, 2012

ModalPopup - Multiple Controls open 1 popup?

Is it possible to have multiple controls open up the same modal popup window? I have content with 3 different links I need to openup the same modalpop up window.

Yes, that's achievable.

You can add client side click event handler to those links, and show the modalpopup in the handler.

For instance:

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager
</div>
<asp:Button ID="Button1" runat="server" Text="Button" />
<asp:Button ID="Button2" runat="server" Text="Button"OnClientClick="$find('mpe').show(); return false;" />
<asp:Button ID="Button3" runat="server" Text="Button"OnClientClick="$find('mpe').show();return false;"/
<asp:Panel ID="Panel2" runat="server" Style="cursor: move;background-color:#DDDDDD;border:solid 1px Gray;color:Black">
<div>
<p>Choose the paragraph style you would like:</p>
</div>
</asp:Panel>

<ajaxToolkit:ModalPopupExtenderBehaviorID="mpe"ID="ModalPopupExtender1" PopupControlID="Panel2" runat="server" TargetControlID="Button1" >
</ajaxToolkit:ModalPopupExtender>
</form>
</body>
</html>