Please guide - How to create dynamic modalpopextender when clicked on dynamically created button in a dynamically created panel.

Hi,

I am creating dynamic panels and each of these panels have an image and a button. I would like to show a modal popup when the button of the panel is clicked. Contents of popup depend on which button was clicked. I would sincerely appreciate if some one could guide me if this is possible with Ajax and AjaxControltoolkit.

Till now I tried to create modalpopupextended dynamically in the click event of button and page fails with an error message that TargetControl could not be found.

Please guide.

Regards & thanks

Kapil 

 

0
ksachdeva17
1/7/2007 8:11:11 PM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

4 Replies
829 Views

Similar Articles

[PageSpeed] 56

Hi Kapil,

Unfortunately, the ModalPopup must have a TargetControlID even though you want to be able to use multiple controls to show the popup.

One solution that I have used effectively is to create a LinkButton that has style="display: none;" and make this the target control of the ModalPopup.   Then you can update the modal popup panel dynamically when any of your buttons are clicked and call Show() to make the popup visible from the server side code. If you want to do it all clientside, then you just call the JS show() method on the modal popup after you have updated your content.

Cheers,

Jason

0
Jason
1/7/2007 10:36:14 PM

Thanks Jason, the trick works for me.

Regards & thanks again

Kapil

0
ksachdeva17
1/8/2007 6:19:45 PM

 i can call modalpopup show() on the server side by the using this code ModalPopupExtender1.Show(); but i want to call show() funtion of the modalpopup from the javascript from client side. i am not getting any clue how can i call show() funtion of modalpopup from javascript me explain it to me through some sample code.

0
friend_bros
7/23/2007 10:02:14 PM

i got the answer of my question

 
use code given below if u want to call show() function of modalpopupextender from sever ( put this code inside any event and it will work )

modalpopupextender1.Show();

and if u want to do it through javascipt use code given below

Show and Hide ModalPopupExtender from JavaScript

1) Assign a BehaviourID to the ModalPopupExtender using the BehaviourID attribute.

BehaviorID ="ModalBehaviour"

2) Use the $find method to get a handle to the Modal Popup Behaviour .

$find ("ModalBehaviour").

3) Call your hide and show methods on the acquired handle.

The Javascript would look like this:

 

<script language="javascript"> 

function ShowModalPopup()
{
$find("ModalBehaviour").show();
}

function HideModalPopup()
{
$find("ModalBehaviour").hide();
}

</script>
 
From Link
http://blogs.msdn.com/phaniraj/archive/2007/02/20/show-and-hide-modalpopupextender-from-javascript.aspx

 

0
friend_bros
7/23/2007 11:28:55 PM
Reply:

Similar Artilces:

How to get the value of dynamically created text box which is created dynamically on click of button control.
<p>Dear AllI am new in asp.net.I am doing one project there I have one doubt.what I want is I have taken two  button controls in my page, in click of first button1 I have  dynamically created one textbox and I added this textbox to my page and also set the id for this textbox,.after that in click of second button2 I want that the value of the textbox will be print in my page by getting the value of the textbbox. some codes are given below. <form id="form1" runat="server">    <div>      ...

Creating a Dynamic button from another Dynamic Button
Hi, I have created a button Dynamically as follows: Button b=new Button(); b.Text="Hello"; this.Controls.Add(b); b.Show(); How to create another Button(some Button) when clicked on the above created button. You have to handle the on click event of the dynamic button. In the onclick event you can create another button in the same way as you have done. Remember to create the dynamic button on every post back other wise you will not be able to capture the click event..Vikram www.vikramlakhotia.comPlease mark the answer if it helped you try this link: http://support.mic...

Create Dynamic Dropdownlist Controls / How to Create Dynamic Dropdownlist Controls
Hi,    This might be useful for someone who strucks with create dynamic dropdownlist/ controls. In ASP.Net is page is stateless. when you are creating the dynamic dropdownlist control following issues you might be facing, 1. After loaded the control, on selected index changed event the control will be disappear. 2. The selectedIndexChanged raised event might not be fired when selection of Dropdownlist. 3. Locate the exact dropdownlist which you created dynamically. 4.Placing this dynamic controls in exact location in the page. Solution: You have to re-create the con...

create and add controls dynamically to dynamically created Table Control
How can i create web server Table control dynamically with vary number of  rows and columns, and  then adding  further  other controls(like  dropdown, Text box etc.)  randomly to the specific created Table Cells. First of all you should use PlaceHolder control to add Table control to it:<asp:PlaceHolder id="PH" runat="server"></asp:PlaceHolder>Code Behinde:Table t = new Table();TableRow tr = new TableRow();TableCell td = new TableCell();//td.Text = "Hello, I am a TD";// Here well create TextBox and add it to TDTextBox txt = new TextBox();tx...

How to create and handle click event of dynamically created Link Buttons??
Hello Can anyone tell me how to create and handle events of dynemicallly created Link buttons?? Thanx for help..   Hi,take a look at this article: Adding a dynamic control to a placeholder control and wire up the event.Grz, Kris. Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons.  I think u have created button in page load event    like Button btn = new Button();        btn.ID = "btnId";        btn.Text = "Submit...

How do I create an event for a dynamically created button?
I have a button that is loaded onto the page dynamically (with another button click actually). I assign it an ID, etc in the code behind file, but since it isn't actually created until after the page loads, I cant assign it a click event: Compiler Error Message: BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types. Source Error: Line 169: End SubLine 170:Line 171: Protected Sub erase_0_Click(ByVal sender As...

button.click for dynamically created button(Please help!)
Hi, I have a simple webform with only 2 web controls (panel1 and button1) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim _btn As Button = New Button _btn.Text = "Submit" _btn.Visible = True _btn.ID = "btnSubmit" AddHandler _btn.Click, AddressOf Me.submitBtnClicked Me.Panel1.Controls.Add(_btn) End Sub Private Sub submitBtnClicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim s As String = &q...

help dynamicly creating a textbox inside a dynamicly created table cell
I am trying to dynamicly create table rows and cells which is fine so far. but I tried adding a textbox to the cells using this code and it does not work>. its the part that creates and adds the textbox that does not work. the table row and cell creation is fine. var newCellvar newRow = theTableBody.insertRow(-1); newCell = newRow.insertCell(0);newCell.innerHTML = 'Option #' + index; newCell.className = 'OpinionOptionsTableLeftCell'    var textTag = document.createElement("input"); textTag.id = 'text1' + index; textTag.type = 'tex...

Creating Delete button for Dynamically created controls?
Hi, I have at long last been able to create controls dynamically. They even maintain state after a request.  (See code below). On clicking the Add button, this code basically creates 4 textboxes + 4 labels on the fly.  Here is the catch and a real challenge for asp.net gurus. Now that I have successfully built an "Add" functionality, I am finding myself in need of a delete button that would delete the last set of controls created per click. Here is my code. Any help would be greatly appreciated. Please bare with me as I learn.(For those who landed on my page through t...

Bubbling Events on Dynamically created controls that are on dynamically created user-controls on a module!! HELP MAH PUHLEASE!
I may be cross posting this question, but I am really going to go crazy.. Please help if you can!I think I am going to go mad. If anyone can help me with this small issue, I will build an idol in your image made of clay, and have nubile maidens dance in front of it in worship!!!!I have a module. Let's call it Module-1Module-1 Connects to a database and gets a list of items.Module-1 Then creates on the fly a number of buttons that represent that list of items.Each button when clicked dynamically creates a web-user control. Let's pull out 1 button, and 1 usercontrol and call them Button-1 and ...

How to create another div when click on the a div element which is created dynamically
Hi,     I created the a div control using java script as below and again i want to add the Click event for the newly created Div control how to add the event for New div control?dv= document.createElement('div'); function showDiv() { dv.setAttribute('id', "div1"); dv.innerText = "Sorting"; document.forms[0].appendChild(dv); dv.onmousedown = function1; // Not Working. It didn't call the function1 }  function function1() {dv1= document.createElement('div'); dv1.setAttribute('id', &...

Dynamically created Button in Panel
I a panel on a web page. I dyanically create a text box and a button within a panel. I set the Command Name of the button, and created the Private Sub to be run with the same command name. However, if I click the button, the sub doesn't run. Any help is appreciated. Code is below for reference. Thanks, Private Sub btn_SelectUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_SelectUser.Click If lb_UserList.SelectedIndex = -1 Then Dim lbl_Error As New System.Web.UI.WebControls.Label lbl_Error.Text = &qu...

ImageButtons Dynamically Created within a Dyanmically created Update Panel-Examples?
Hello... I have a complex issue, and I am looking for guidance. I have a huge form, which users can click an imagebutton and then I programmatically create a set of form fields and the HTML around those form fields.We refer to each set of form fields and HTML wrappers, created per each imagebutton click, a form-part-replicant.I quickly learned that I could do this with update panels and placeholders. Great! However, I also found the issue, of when you postback to the server, the fields(controls) you created the last time you went back to the server, disappear from viewstate.I fo...

creating dynamic datawindow using create...
I am using the create statement to create a dynamic datawindow that will be of type Group. When a datawindow is created of type Group the title(if added to the create statement)/date/ and page numbering are automatically added. The only downfall is that the items automatically added have no names associated to them. Unfortunately I need a name to represent the line of datawindow code so that I can change x/y coordinates and other properties of the object. If you have any idea as to how i can add a name to already created datawindow syntax objects such as Text, and Computed fields ...

Web resources about - Please guide - How to create dynamic modalpopextender when clicked on dynamically created button in a dynamically created panel. - asp.net.ajax_control_toolkit

Resources last updated: 1/23/2016 11:46:44 PM