UserControl in AJAX ModalPopupExtender in another UserControl - asp.net

I am working on a ASP.NET (with Visual Basic) web application.
I have been trying to make a user control for two days, but i have an issue that i could not solve.
I have a FormView that I want to fill with an object, that i get from another user control. This second user control must be shown in a ModalPopupExtender when I click on an ImageButton. This works correctly. However, when i use the control, the modal popup is closed.
I use the same user control in a ModalPopupExtender, in others .aspx pages, and it works correctly, so I don't think that the error comes from it. It fails only when the user control and ModalPopupExtender are used in another control.
I show you some screenshots to explain easier :
www.noelshack.com/2012-39-1348649045-1.png
1 : .aspx web page,
2 : Button which shows the popup,
3 : .ascx user control,
4 : Button which closes the popup
This configuration works correctly : I can use my user control and the popup is closed only when it must be.
www.noelshack.com/2012-39-1348649045-2.png
1 : .ascx user control,
2 : ImageButton which shows the popup,
3 : .ascx user control,
4 : Button which closes the popup
The popup with the control is correctly opened, but when i try to search with the control (click on "RECHERCHER"), the popup is closed.
www.noelshack.com/2012-39-1348649045-3.png
Then, if I click again on the ImageButton that shows the popup
www.noelshack.com/2012-39-1348649045-4.png
We can see that the user control worked correctly.
So the only problem is that the popup is closed when I try to use the user control.
And this occurs only when i work in another user control, it works correctly in a page.
Here is the part of my code where i use the popup and the user control :
In the page, which works :
www.noelshack.com/2012-39-1348649045-6.png
In the user control, which does not work :
www.noelshack.com/2012-39-1348649044-5.png
You can ask me if you don't understand something or if you need more explanations
Thank you for your help and sorry for my english. Sorry for the links, I can't post images or hyperlinks...

Try using the following at the bottom of the RECHERCHER button:
mymodalpopupextender.show()

Related

Open aspx page in modal popup

I have an aspx page (let say page1.aspx) having labels and buttons on it. In some other page i need to show content of page1.aspx in modal popup. I have read many articles, but did't find exact solution. Some of the possible ideas are, 1: create Usercontrol, 2: Use Server.execute() method.
Please suggest any solution. Thanks
If you simply want to show a popup (a modal dialog) you can create an user control which contains the markup form page1.aspx and use either AjaxControlTookit (ModalPopup) or jQuery.dialog
I prefer the jQuery.Dialog, it saves 2 postbacks to the server and is easier to integrate.
Here is how to integrate it with ASP .Net, a little trick so the inputs inside that dialog will be posted to server, when the button is clicked.

RegularExpressionValidator firing too early

I have an ASP.NET web application that is using RegularExpressionValidator controls inside of a user control. The user control is placed inside of a panel with an ajax:modal popup. When I click the link, it will open the popup displaying the user control.
What is happening is when I click the link to open the popup, it is throwing a postback and activating the validators before the user has any opportunity to type anything into the boxes. I need to be able to click the link, open the popup, fill out the text boxes, and submit. The validators should only run when the submit button is clicked. Any ideas?
setting the validators parameters on the load in the code behind of the popupbox might fix your problem

Handle Enter Key on Website (ASP and VB)

So I have a website with multiple asp controls. When I press enter inside by login form, the search function runs because it's the first thing found on the page.
How would I handle the enter button so that when the active textbox is for the login form, the loginbutton code actually runs rather than the searchbutton.
One last problem is that the login controls are inside a loginview so the hierarchy shows that the asp:textbox and asp:button for logging in are inside 3 tags like so:
<loginview>
<login>
<logintemplate>
//controls are here.
</logintemplate>
</login>
Just a note that all controls are asp and that all code is prefered in VB. Thanks
You want to set the default button on the form like this:
Page.Form.DefaultButton = "LoginButtonId"
MSDN Docs: http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlform.defaultbutton%28VS.80%29.aspx
Also, see this question for an issue I had in Firefox related to this : Default Form Button in FireFox

How to reaload Dropdown control In this way..please guide

I have 2 aspx pages with C# code behind. Page one have 4 text boxes , one drop down and 2 buttons. Out of 2 buttons one if for appearing the second page as Popup ( as per system requirement. I could use here Ajax popup control , but requirement is different). So my page 2 has text box and button . on click of button of page2 textbox value will go in the database. and page will close. ok ? but same time, dropdown on the page1 should be fill come with fill up the records without refreshing the page1.some how the values in 4 textboxes should be there in textboxes... i tried on my best to elaborate problem.please guide.
You would have to use AJAX to populate the drop down list, which you can do using a web service. Another problem with this is that if you use the standard ASP.NET DropDownList control, and modify the list on the client, you may get an error because the dropdownlist expects the list provided to it from the previous load.
Alternatively, when the user closes page 2, it could call a method on page 1 that calls __doPostBack to force a page postback in page 1, so you could use server code to populate page 1.
A separate page is going to add to the challenges, it would be a lot easier to leverage teh AJAX popup IMHO.
HTH.
Seems like you have 2 pages Page1 and Page2. Clicking on a button from Page1 takes you to a popup page Page2. Then on submit of Page2 you need to refresh DropdownList on Page1 but you need PartialPostback instead of FullPagePostback.
If that is the case. You can javascript to do partialpostback:
http://www.asp.net/%28S%28ywiyuluxr3qb2dfva1z5lgeg%29%29/learn/ajax-videos/video-172.aspx
edit:
To call a method from popup page you need to access method of parent page like: parent.RefreshDropDown();
Reagards.

Invoking button click event on one page from another page ASP.NET

I have two aspx pages i.e. default1.aspx and default2.aspx. Default1 contains some controls, tables etc. I am showing Default2.aspx into anthor window using hyperlink, setting its target to _blank. What I need is to call a button event which is placed inside Default1.aspx as soon as Default2 is closed (i.e. as soon as the new window showing default2 is closed).
Although, I know that this can be accomplished by showing the default2 into a modal popup i.e. show the default2 into a modal dialog and after that call the button event using javascript. But due to some reasons i am not permitted to do that.
Could some one please show me how i could do that.
If I was you, I'd refactor what will the button in page 1 do in a helper method that both of pages can call.

Resources