Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Monday, March 26, 2012

Modal Popup from Code Behind ?

Is there a way I can use the modal popup extender from the code behind? I'd like it to popup as a "confirm" dialog if a value in the form is within a specific range. ie: if a date is less than three days away.

Thanks !!!

Probably the best way to do this is to place your form controls inside of an update panel. Then based on the items chosen you change the enabled property on the modal popup extender. You could add the control to the Controls set on your page, but depending on your form validation, that may happen too late in the game.

Hope that helps!

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...

Modal Popup Extender Repositionmode is not working correctly

Hello,

I have a modal popup that contains a form with a height that exceeds the screen size. When i try to scroll down the modal popup repositions itself so that i never can reach the bottom content. I have tried downloading the latest Ajax Control toolkit release (1.11119) and implemented the RepositionMode = "None" attribute but it still doesn't work. Anyone have any suggestions?

Thanks,

Tony

Hi Tcha143,

As far as I know, it is a known issue. We suggest that you should post it toCodePlex. We will mark it as "resolved" so our community members won't waste their time to reproduce your issues. Thanks for understanding.

Best regards,

Jonathan

Modal Popup Issues

I have a couple of issues with the modal popup extender control.

1- When the popup shows, any dropdown list on the form behind gets hidden.

2- I can't add vb code (not script) under the buttons on the popup that are selected as either the ok or cancel controls of the popup extender.

3- To get around problem # 2, i didn't specify an ok or cancel button on the extender, and have code i want to run under the _click event of the buttons on the popup panel. The problem with that is, when the popup hides, all my dropdown lists on the base form remain hidden.

So the three problems are related in my scenario.

Thanks

Hi,

the ModalPopupExtender hides the select elements (DropDownList-Controls) when you use an Internet Explorer < 7.0. That is necessary, because the select elements always on top. This behavior is normal.

See my post:http://forums.asp.net/thread/1555265.aspx for your issue 3.

Regards
Marc André


Thanks,

I was able to solve this problem by hidding the popup panel using client side javascript.

Modal popup in tabs

Hi Im trying to use a modal popup in my project.

Im generating a bunch of control on my form and some of them (buttons) when clicked should open a modalpopup and on okclick store some info in a db

the problem Im having is that when I am not in the tab with the button that will make the popup open, I see the popup, but when im inside the right tab popup disapear and I can't seem to make it appear.

second problem Im having is that I can't seem to find a way for having multiple button to open the same popup.

hmm Now the modal popup is always shown. maybe its a properpy of the target control or of the popup?
Here is the code

<ajaxToolkit:ModalPopupExtenderID="MPE"runat="server"

BackgroundCssClass="modalBackground"

TargetControlID="test"

PopupControlID="PanelAddLine"

DropShadow="true"

OkControlID="SavePrice"

CancelControlID="CancelButton"

>

</ajaxToolkit:ModalPopupExtender>

<asp:PanelID="PanelAddLine"runat="server"CssClass="modal">

Enter the number of Days<br/>

<asp:TextBoxID="TextBoxNbDays"runat="server"></asp:TextBox><br/>

<asp:ButtonID="SavePrice"runat="server"OnClick="SavePrice_Click"Text="Add"OnClientClick="AfterAdd()"/>

</asp:Panel>

<asp:HiddenFieldrunat="server"ID="test"Value="a"Visible="false"/>


well im not sure about the tabbing problem because im to busy right now to try to replicate it myselft, but i think i know whats going on with the problem you have trying to open the same modal popup from different buttons. The targetControlID for a modal popup lets you set a button to open the popup, but because you want more then one button to you should do the following
* Create a hidden field and assign its ID as the targetControlID for the modal popup
* Now for each button you have that you want to open the modalPopup, create an eventhandler for the button with this code inside(example further down)

modalPopup1.Show();

* to programmatically add the event for the button do this

myButton.Click += new EventHandler(this.myButton_Click);

* and then write the click function that will be called due to the above code

private void myButton_Click(object sender, EventArgs e)
{
modalPopup1.Show();
}


thats weird, i guess i cant be much more help, i love doing stuff programatically in C# to im not great with the aspx file sytax when stuff like this happens :(


could it be just a question of css?


Do I have to set special value to my css to make the modal popup work.

Can a master page could possibly be reason for this


Wookie:

hmm Now the modal popup is always shown.

I think you need to call MPE.Hide(); in the server side click event handler of the save button.

Also, don't specify OkControlID="SavePrice"

Wednesday, March 21, 2012

ModalPop-Up

Hello,

On my web form I have a repeater control which has a link button as the ItemTemplate.

<asp:RepeaterID="rptMyFavoriteReports"runat="server"OnItemCommand="rptMyFavoriteReports_ItemCommand">

<ItemTemplate>

<asp:ImageID="Image1"runat="server"<b><%#DataBinder.Eval(Container.DataItem,"ReportName") %></b> (<ahref="#"class="anchor">More Information</a>)

<asp:Linkbuttonid="lnkBtn"runat="server"CssClass="anchor">Remove</asp:Linkbutton><br/>

</ItemTemplate>

</asp:repeater>

When the user clicks on this link button the Modal Pop-up should show up. When i set the the modal pop-up extender properties as TargetControlsID="linkbutton:

<atlasTools:ModalPopupExtenderID="ModalPopupExtender1"runat="server">

<atlasTools:ModalPopupProperties

TargetControlID="lnkBtn"

PopupControlID="Panel1"

OkControlID="OkButton"

CancelControlID="CancelButton"

OnOkScript="OnOK()"/>

</atlasTools:ModalPopupExtender>

i get the following error.

Object reference not set to an instance of an object.

NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.AtlasControlExtender.ExtenderControlBase`2.ConnectDataBindingHandlers() +276
Microsoft.AtlasControlExtender.ExtenderControlBase`2.OnInit(EventArgs e) +45
System.Web.UI.Control.InitRecursive(Control namingContainer) +459
System.Web.UI.Control.InitRecursive(Control namingContainer) +271
System.Web.UI.Control.InitRecursive(Control namingContainer) +271
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1739

Any sugesstion how to over come this.

Thanks!!

Hi Radhikap,

Try putting the whole extender inside the repeater's ItemTemplate.

Thanks,
Ted

Hello Ted,

It worked like a charm Thank you

Radhika


Another Problem

my modal pop-up has yes or no options.When the user clicks on yes i have the onOkScript to a javascript function.

my Qs is how do i get the javascript to raise the event repeater_ItemCommand event of the repeater control.

Thanks!!

Radhika


Can you have the onOkScript code end by "clicking" (via .onclick()) a suitable element in the repeater control? I think people have had some success with this approach in the past.

ModalPopUp & ValidatorCalloutExtender Issue

I have required fields that are contained within the ModalPopUp, the problem arises when I submit the form the validation popup appears behind the modal form.

Has anyone encountered this before and if so have they come up with a solution?

Help would be appreciated on this!!

This is a valid scenario and we have seen issues where it would be reasonable to not have the modal popup to have the highest z-index. If you could open an issue to track this that would be great:http://www.codeplex.com/AtlasControlToolkit/WorkItem/Create.aspx. We will investigate possible solutions to make your scenario and other similar scenarios regarding the modal popup z-index.

I am having the same issue.

Any help would be appreciated.


I'm having the same issue. I have a required validator in modal popup, but OK button on the ModalPopup control ignores that required validator.


asp.net_programmer:

I'm having the same issue. I have a required validator in modal popup, but OK button on the ModalPopup control ignores that required validator.

I opened anissue for this on Codeplex, hopefully someone can give us an answer for this soon. If not updated ModalPopup control, then some kind of workaround would be helpfull. Thanks.


Any update on this issue?

Thanks in Advance.


Well I don't know if this adds to this discussion or not. I can not no matter what get it to center. I have no idea why it will not but all I see is the lower left corner and cancel button of my popup in the upper right corner. So I figured I would specify the X and Y properties to possition it. So I specified X=250 and y=250 and this was the only change the modal was visible now but in possition maybe 50,50 however now it was not active and greyed out with the background. Remove the X and the Y and it goes back so I can only see the cancel button but it is active again.

Selam Aleyk,

If location of the validatorcalloutextender control is in modal popup panel, it is working ok.

Oznur