Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Wednesday, March 28, 2012

Modal Popup awith datagrid

I m using Button click to show Datagrid.

When Button is clicked Modal popup appears showing updating as status for 4 secs..and side by side in server side Datagrid is filled.

Now the issue is that Modal up Appears for 4 sec but Datagrid is not displayed.

Query for Fetching the data from Database is running Fine and do bind the data to Data grid but grid is not displayed.

I have update Panel where i put Button (To be clicked),Update Progress and Modal Popup

I have not put Datagrid in Update Panel.

Can this be problem??

Yes you might be right. Try by putting the DataGrid inside the UpdatePanel. And for more details can you post your code, so that it will be easy to diagnolise the problem.


Hi Varun,

In your situation, when click on the Button which is inside the UpdatePanel , it will post all the elements back to the server and returns all to the client but only refresh the content which is inside the UpdatePanel. So you should put the DataGrid inside the UpdatePanel. My suggestion is when updating shows UpdateProgress and when it finished ,we force the ModalPopupExtender to be shown.The DataGrid is moved into the Panel which is associated with ModalPopupExtender.

For example:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function EndRequestHandler(sender, args){
$find("ModalPopupExtender's BehaviorID").show();

}

Best regards,

Jonathan

modal popup and update panel

hi there, i have a login button that when it is clicked, the modal popup will trigger and was able to logon to the system. the page has two link buttons, when i click on the 2nd link, the update panel will display the items assiciated with that link, and when i click on the 1st link, the update panel will display the items associated to the 1st link, its lakie i have a tabs..the problem is, when i added the modal popup on that page, and clicked on the 2nd link, it will not display the items of that link, i mean, it will not trigger any event at all...but when i remove the modal popup extender on that link, it will toggle..what am i missing here??please help.

thank you .Smile

Can you show me some code so that I can reproduce it?

Modal PopUp control needs dynamic data on button click

greetings,

Have a modal popup control as follows:

<

cc1:ModalPopupProperties
TargetControlID="lb_verify"
PopupControlID="P_popup"
BackgroundCssClass="modalBackground"
DropShadow="true"
OkControlID="lb_ok1"
OnOkScript="onOk()"
CancelControlID="lb_cancel1"/>
</cc1:ModalPopupExtender>

What I'm trying to do is to populate a gridview full of options (that is on the p_popup panel) when the user clicks the lb_verify link button. This gridview will be populated based on a textbox entry, so it's dynamic.

When I try to do this on the lb_verify.click action, the sub does not fire... only the popup modal...

Following is my lb_verify sub just in case that will help...

Protected

Sub lb_verify_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles lb_verify.Click
Dim AVAs AddressVerification =New AddressVerification
Dim APAs AddressProperties =New AddressProperties
With AP
.address1 = tb_address1.Text
.city = tb_city.Text
.state = tb_state.Text
.zip = tb_zip.Text
EndWith
Dim resultAsString = AV.AddressVerified(AP)
SelectCase result
Case"M"
L_msg.Text ="modal popup / pick from grid"
gv_verify.DataSource = AV.GetAddressAlternates(AP)
gv_verify.DataBind()
CaseElse
L_msg.Text = result
EndSelect
EndSub

Let me know and thanks.

Rock

This sounds like work item 207 which is not yet implemented.

Modal Popup disappears on any post back

Currently I have User Control that has radio button list that changes options on the user control, some text boxes and a button that updates a list box with options selected within the user control. Any object that causes a post back seems to cause my modal popup control to disappear. How can I better control this? There are three postback operations that the user will go through in order for thems to get the correct selection - which should cause the modal to disappear and an update to happen to the calling page controls.

Any suggestions?

How about putting the UserControl inside an UpdatePanel if it isn't? Is this what you are trying to do? (The WebUserControl you'll have to supply.)

<%@. Page Language="C#" %><%@. Register src="http://pics.10026.com/?src=WebUserControl.ascx" TagName="WebUserControl" TagPrefix="uc1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><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> <script type="text/javascript"> function Show() { $get('WC').style.visibility = 'visible'; } function Hide() { $get('WC').style.visibility = 'hidden'; } </script> <button id="show" onclick="Show()"> show</button> <button id="hide" onclick="Hide()"> hide</button> <div id="WC" style="visibility: hidden"> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <uc1:WebUserControl ID="WebUserControl1" runat="server" /> </ContentTemplate> </asp:UpdatePanel> <button id="close" onclick="Hide()">close</button> </div> </div> </form></body></html>

I do have my user control within the UpdatePanel, currently. Within my user control there are database queries and options (basically its a search utility that give the user multiple options for searching the database to find the correct record). Once they have filled in their options within the search utility they are given a listbox (still within my user control) to select a record. Once the record is selected the calling page gets a control updated with the record ID which then causes a textchanged event that pulls up that record detail.

I wanted to utilize the modal popup extender so that when they search they can not horse around on the calling page. I do have have a version of this working with showing and hiding the update panel directly - however the modal popup extender (still using the atlas control) seemed to be a better option for this type of implementation.

By the way thanks so much for your quick response...


I decided it might be easier to give you my page code: Keep in mind that the problem is the post backs within my User Control. Any post back within the User Control itself cause the Modal Popup to become unmodal...Tongue Tied

1<%@. Page Language="VB" AutoEventWireup="True" %>23<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>4<%@. Register src="http://pics.10026.com/?src=PagesAndControls_View/SiteSelection.ascx" TagName="SiteSelection"5 TagPrefix="uc1" %>6<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">78<script runat="server">910 Protected Sub OkButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)11 Label1.Text = "OK Button Clicked"12 Me.txtSiteID.Text = "OK Button"13 Dim myPopUp As ModalPopupExtender = Me.ModalPopupExtender114 myPopUp.Hide()15 End Sub1617 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)18 Label2.Text = "Other Button Clicked"19 Label1.Text = "Other Button Clicked"20 End Sub21 Protected Sub myTestScript()22 Label2.Text = "text script initiated"23 End Sub24</script>2526<html xmlns="http://www.w3.org/1999/xhtml">27<head runat="server">28 <title>Test Selection Page29 </title>30</head>31<body>32 <form id="form1" runat="server">33 <asp:ScriptManager ID="ScriptManager1" runat="server">34 </asp:ScriptManager>35 <div>36 <asp:UpdatePanel ID="PagePanel" runat="server">37 <ContentTemplate>38 <asp:Label ID="Label1" runat="server" Text="Enter Site ID or Search:"></asp:Label>39 <asp:TextBox ID="txtSiteID" runat="server"></asp:TextBox>40 <asp:ImageButton ID="SearchButton" ImageUrl="~/images/search.jpg" runat="server" />41 <asp:Panel ID="Panel1" CssClass="modalPopup" runat="server" Style="display: none"42 Wrap="False">43 <uc1:SiteSelection ID="SiteSelection1" runat="server" />44 <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>45 <div align="center">46 <asp:ImageButton ImageUrl="~/images/checkmark2.jpg" ID="OkButton" runat="server"47 OnClick="OkButton_Click" />48 <asp:ImageButton ImageUrl="~/images/closebutton5.jpg" ID="CancelButton" runat="server" />49 </div>50 </asp:Panel>51<!--52 <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />53 -->54 <cc1:ModalPopupExtender ID="ModalPopupExtender1" TargetControlID="SearchButton" runat="server"55 PopupControlID="Panel1" BackgroundCssClass="modalBackground" DropShadow="true"56 CancelControlID="CancelButton" OkControlID="OkButton" />57 </ContentTemplate>58 </asp:UpdatePanel>59 </div>60 </form>61</body>62</html>

Are you using the latest ModalPopupExtender in the AJAX Control Toolkit release 61020?

http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=AtlasControlToolkit&ReleaseId=825


I'm pretty sure that I am. I thought maybe my modal popus was outdated, so I deinstalled the atlas and installed the ajax version just yesterday and the problem persisted


Hey.

Was any progress made on this? I'm experiencing the problems now too (with the December Futures, and latest Toolkit)

Thanks,
Chris


The way I fixed this modal problem was by defining a boolean property PopupOpen (and keeping it in session). In the pre_render of the control i call modalpopupextender.show if PopopOpen is true. By setting the property I can control whether the popup is Open (you can wrap this in a user-control).

Hope you get the idea,

Martijn


Thanks...

I just managed to figure it out a different way. I addedUpdateMode="conditional" to the UpdatePanel on the page. Works a treat!

Modal Popup Extender - Setting Focus

Hi,

I have HostModalPopup.aspx webform with a ShowModalWindow button (When clicked shows a Modal Popup Window) and there are some text boxes after the button.

The Modal Pop Up window has 3 controls: a text box field, a submit button and a close button.

1) When the Modal Popup window is shown, I would like to be able to setfocus to the textbox. I thought I should be able to do this with document.getElementById('TextBox1').focus() on some event that gets triggered when the modal popup window is made visible, but I could not find any such DHTML event.

2) The taborder/tabindex of the controls in HostModalPopup.aspx, once the ShowModalWindow is opened and closed, no longer works. If I set the focus to one of the textboxes and hit tab the cursor goes to address bar instead of going to a textbox with next tabindex. I am using AJAX Control Kit verion 1.0.10606.0

Any help is greatly appreciated.

- Surya

Use ScriptManager1.SetFocus(TextBox1)


http://www.asp.net/AJAX/Documentation/Live/mref/O_T_System_Web_UI_ScriptManager_SetFocus.aspx

http://msdn2.microsoft.com/en-us/e04ah0f4


Thank you guys!

The ScriptManager.SetFocus did it for the first issue.

-Surya

Modal Popup Extender

hi

i have used ModalPopupExtender on my web page and it is really good but the problem is if i click any button then it close the panel.

is it possible to use some validation control on the panel like i want to insert data into database, also i want to add a close button on the panel, without click close button that panel will be enable on the page.

thanks is advance

You can add a UpdatePanel in your panel, and put your detailviews in this UpdatePanel.

All the behavior you do in the UpdatePanel will not effect other controls that out side of this Panel.

Modal Popup extender

Hi,

I have one page on that one button is there, when I click the button am calling one function and after executing that function am using Response.write method to show popup and download the genreated file by that function.

But problem iss when I click upon that button am showing modal popup but that pop is not going off when response.end occurs.

I used one function in client script and tried to call with code as,

Page.ClientScript.RegisterStartupScript(Me.GetType(),"Sample", _

"<script language=""javascript"" type=""text/javascript"">" & vbNewLine & _

"Sample()" & vbNewLine & _

"</script>")

ans that sample function code is,

function Sample()

{

var modal = $find('ModalPopupExtender2');

modal.hide();

}

but this function is not getting called.

My main concern is to hide that modal popup when that save/download dialog gets disappered or cancelled.

Can anybody give me the solution over this.

Please.

Thanks,

Rohit

Hi Rohit,

Would you please use these code?

Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "SampleKey", "sample()", true);

If it doesn't work, please review its generated HTML code. You can post your workable and tiny repro here.

Best regards,

Jonathan

Modal Popup Extender and Page Refresh ?

I use Modal Popup Extender and there are two buttons, login button and cancel button...Everytime any of the buttons are clicked whole page is refreshed. I want to stop that for cancel button, but don't know how that will work for login as I want some underlying events to happen when that is clicked.

How can I achieve the above functionality ?

Wrap the modalpopup in an updatepanel to take advantage of partial postbacks. You can also assign the cancel button as the cancelcontrolid of the modalpopup so that it will close the popup using JS without a postback.

Monday, March 26, 2012

Modal popup extender postback issue

Hai

I'm using Ajax toolkit modal popup extender to open the popup window, In that window having two buttons, save button save the entered information into database and cancel button close the popup window.When click the save button changes are saved and window remain open, this is my requirement. But when i clicked that save button the informations are saved and popup window is closed.

How i will get my requirement ? Plz help anyone.

kamal...

use Show method of the control object to make it visible


Hi Kama19101980,

If you want to show a window when storing data to database and hide the window as soon as the process finished, I think you should better useUpdatePanel + UpdateProgress. Otherwise(keep the window open after storing the data), we shall use UpdatePanel + ModalPopupExtender.

Now you can put all the inputs inside an UpdatePanel and the Button is set to be the trigger of the UpdatePanel or just inside the UpdatePanel.For example,

<UpdatePanel>controls <Button></UpdatePanel>

When the partial update occurs, we show the ModalPopupExtender. You can do it like this,

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);

function BeginRequestHandler(sender, args){
$find("ModalPopupExtender's BehaviorID").show();
}

I hope this help.

Best regards,

Jonathan

Modal Popup from code behind

I'm having issues trying to load a Modal Popup from a OnClick event from an Image Button. This code goes through and actually runs the sub from the code behind file, but when the page actually finishes loading the modal popup does not show up, it basically just refreshes my page. Can anyone tell me what I'm doing wrong? I'm needing this to work because eventually I'm going to be putting this into a repeater for a bunch of image thumbnails, on click of a particular thumbnail it will load a modal popup with a larger image and some text information.

In my actual file (code below is in a test page without the repeater information), I have the same code but add in my repeater code around it, but on button click it won't even fire the sub from code behind, it simply does a page refresh and thats it.

If I can get this test page to work, then maybe the other will fall into place too.

Frontend Code:
1 <asp:scriptmanager runat="server"></asp:scriptmanager>
2
3 <asp:ImageButton runat="server" ID="test" OnClick="myRun" ImageUrl="/my.jpg" />

4 <asp:Button ID="btnShowPreview" Visible="False" runat="server" Text="Button" />
5
6 <%--Designs--%>
7 <asp:Panel ID="pnlPreview" CssClass="popupModal" Style="display: none;" runat="server" Width="600px">
8 This is the panel.
9 </asp:Panel>

Backend Code: 
1Sub myRun(ByVal SourceAs Object,ByVal ArgsAs ImageClickEventArgs)2Dim modPreviewAs New AjaxControlToolkit.ModalPopupExtender34 modPreview.ID ="mpePreview"5 modPreview.TargetControlID ="btnShowPreview"6 modPreview.PopupControlID ="pnlPreview"7 modPreview.BackgroundCssClass ="modalBackground"9End Sub
Hope you can help.
Micah

In your codebehind you are just creating the popup extender, you aren't showing it.
You need to call .Show() when you've created it.

Btw, you don't need to create it in codebehind. Create in your .aspx instead and just call Show() on it.


Good call on that one, I was thinking about it later that night to and couldn't figure out why I was doing it from code behind.

I moved the model popup extender to .aspx page and call the mpePreview.Show() from code behind, it does run through the code still, but never displays the modal still.

Any other suggestions? Do I need to have certain properties set on my modal and scriptmanager that I'm missing?

Thanks for the help

MIcah


Ah ha, kind of figured it out, my hidden button is causing the issue, if I make my button visible it works, if I make it invisible it fails.

So now I just need to figure out how to hide my control and have it still fire correctly.


style="display: none;"

will hide effectively.

<asp:Button runat="server" ... style="display: none;" />

Intellisense won't pick it up but you can put it there.


Ahh, sweet that worked perfectly! I hadn't even thought about that option.

Great, Thank you very much.

Micah

Modal Popup In A UserControl (Problems)

My problem is that i have added the modal popup control into a usercontrol. The usercontrol has the code for the modal and the button to initiate the popup.

When i added the usercontrol to a page and click on it this is what i get. My site is centered so i have already scrolled pretty far to the right already so that only the right hand side of my site is showing but then youll see how much grey there is. If you look at the bottom of the picture youll see that there is still alot of room left to scroll to the left. This is my problem. Im not sure why its not displaying on the main screen like the examples.

Now if i remove it from the usercontrol and just put it in the master page then it works fine.

Any ideas??

I tried this with the Toolkit sample page and could not repro the issue. Could you possibly post a small repro? Note that we have fixed some modalpopup positioning issues in the latest versions of the Toolkit. Although, we know that there are some more improvements required for specific cases. If you have the sample ready where the modalpopup does not work as expected that will help us a lot.


I updated to the newest version and while it does not do the same thing its still off centered. Here is code for the main page and user control.

USERCONTROL:

<div style="position:absolute; right:0; top:0;">
<asp:ImageButton ID="cmdGetHelp" runat="server" ImageAlign="absmiddle" ImageUrl="/images/icon_help_32px.gif" />
</div
<asp:Panel ID="Panel1" runat="server" Style="display: none" CssClass="modalPopup">
<!--HEADER-->
<asp:Panel ID="Panel3" runat="server" Width="500" CssClass="modalTitle" style="cursor:move;">
<div>
<p>TITLE</p>
</div>
</asp:Panel
<!--CONTENT-->
<div>
Content goes here

 </div> <!--BUTTONS--> <div style="text-align: right;"> <asp:Button ID="OkButton" runat="server" Text="Submit"/> <asp:Button ID="CancelButton" runat="server" Text="Cancel" /> </div></asp:Panel><ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="cmdGetHelp" PopupControlID="Panel1" BackgroundCssClass="modalBackground" OkControlID="OkButton" OnOkScript="ClosePopup()" CancelControlID="CancelButton" DropShadow="true" PopupDragHandleControlID="Panel3" />

DEFAULT.APSX

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title> <style type="text/css" > .page-container {width:900px; margin:0px auto; border:solid 1px rgb(150,150,150);font-size:1.0em;} .main {border:solid 1px orange; clear:both; width:900px; padding-bottom:30px;} .main-navigation {border:solid 1px red; display:inline /*Fix IE floating margin bug*/; float:left; width:200px; overflow:visible !important /*Firefox*/; overflow:hidden /*IE6*/;} .main-content {border:solid 1px green;display:inline /*Fix IE floating margin bug*/; float:left; width:650px; margin:0 0 0 30px; overflow:visible !important /*Firefox*/; overflow:hidden /*IE6*/;} .footer {border:solid 1px blue; clear:both; width:900px; padding:1.0em 0 1.0em 0; font-size:1.0em; overflow:visible !important /*Firefox*/; overflow:hidden /*IE6*/;} .header {width:900px; font-family:"trebuchet ms",arial,sans-serif; border:solid 1px red;} .header-top {width:900px; height:80px; background:rgb(240,240,240); overflow:visible !important /*Firefox*/; overflow:hidden /*IE6*/;} .header-middle {width:900px; height:70px; overflow:visible !important /*Firefox*/; overflow:hidden /*IE6*/;} .header-bottom {width:900px; } .header-breadcrumbs {position:relative;clear:both; width:890px; padding:0.9em 0 0.9em 0; background:rgb(255,255,255) } </style></head><body> <form id="form1" runat="server"> <asp:ScriptManager Id="ScriptManager1" runat="server" EnablePartialRendering="true"/><!-- Main Page Container --> <div class="page-container"><!-- A. HEADER --> <div class="header"><!-- A.1 HEADER MIDDLE --> <div class="header-middle"> Header-Middle </div><!-- A.2 HEADER BOTTOM --> <div class="header-bottom"> Header-Bottom </div><!-- A.3 HEADER BREADCRUMBS --> <div class="header-breadcrumbs"> Header-breadcrumbs <lmf:Help ID="help" runat="server" /> </div> </div><!-- B. MAIN --> <div class="main">Main Content place holder<!-- B.1 MAIN NAVIGATION --> <div class="main-navigation">main-navigation </div><!-- B.2 MAIN CONTENT --> <div class="main-content">main-content </div> </div><!-- C. FOOTER AREA --> <div class="footer">footer </div> </div> </form></body></html>

Ok it seems that when I place the user control inside a <div> that has absolute or relative positioning then it behaves incorreclty.

What im trying to do is this

I have my breadcrumbs and at the far right of the breadcrumbs i want to show a help image. When that image is clicked on it will open the modal popup.

My problem is getting this image positioned in the exact place that i want it to and in trying to do so with positions, i seem to have caused the problems.

If i place the user control in any other div except for the header-breadcrumb <div> then it displays in the upper right hand of the screen because of the position of the div around that image for the help image. When i do this it works correclty. So it looks like im having css issues but im not sure how to solve them. Any ideas?

This is the div the user control is being placed in. (well not in the code above, in the code above the class header-breadcrumbs has the relative position)

<divstyle="position:relative;">

<lmf:HelpID="lmfHelp"runat="server"/>

</div>

<divstyle="position:absolute; right:0; top:0;">

<asp:ImageButtonID="cmdGetHelp"runat="server"ImageAlign="absmiddle"ImageUrl="/images/icon_help_32px.gif"/>

</div>


Thanks a lot for the repro. I have updated this workitem with the files:WorkItemId=10693.

We will look into fixing it for our next release.


kirtid,

For my peace of mind, is this a problem with the modal popup control in respect to positioning or is it a problem created by something that im doing?

EDIT: Never mind kirtid. If i would of just clicked on the workitemid i would of seen that you had recreated the problem and submitted the problem.

Thanks.

Modal Popup In A Repeater

Hi,

Is there a way to use the ModalPopupExtender from inside a repeater -- each item would have a "delete" link button, and on clicking this, the Panel should be shown? Ive tried everything I can think of, but am not getting anywhere.

Thanks

Joe

Hmmm, I have seen modalpopupextender in the repeater before and it worked fine. Do you get any javascript errors, run-time errors about the extender setup, and how are you wiring the extender to the actual button that will cause the pop up to appear?


The ToolkitTests\Manual\DataboundDynamicPopulate.aspx file that comes with the Toolkit includes a ModalPopup in a repeater (DataList).


Thanks for the heads up. Between this and another article I found (sorry, cant find it right now to give credit), I came up with the solution I was looking for.

My solution is here (for my future reference): http://blog.joelowrance.com/archive/2007/07/10/ajax-modalpopupextender-in-a-repeater.aspx


modal popup problem. blank textboxes

hi, im having problems here. i have a modal popup that when user clicks the edit button, the modal popup will appear and it contains the textboxes for editing.what's od is that the textboxes are all blank and i when i checked my codes not using modal popup, it is doing fine. i have these codes below:

1<asp:Button ID="btnEditPer" runat="server" Text="OK" />2 <asp:Button ID="btnCancel" runat="server" Text="Cancel" />3 </asp:Panel>45 <cc1:ModalPopupExtender ID="mpEditPer" runat="server"6 TargetControlID="lbEditPer"7 PopupControlID="Panel1"8 BackgroundCssClass="modalBackground"9 DropShadow="true"10 CancelControlID="btnCancel" >11 </cc1:ModalPopupExtender>

and then in the code behind:

1if (!IsPostBack)2 {3string id = Request.QueryString["EmployeeID"];4 Employee emp = Employee.ShowEmployeeByID(id);56this.lblFirstName.Text = emp.FirstName;7this.lblMiddleName.Text = emp.MiddleName;8this.lblLastName.Text = emp.LastName;9this.lblBirthdate.Text = emp.BirthDate.ToString();10this.lblBirthplace.Text = emp.BirthPlace;11this.lblNationality.Text = emp.Nationality;12this.lblReligion.Text = emp.ReligionID;13this.lblGender.Text = emp.Gender;14this.lblCivilStatus.Text = emp.CivilStatus;15this.lblHeight.Text = emp.Height;16this.lblWeight.Text = emp.Weight;17this.lblHairColor.Text = emp.HairColor;18this.lblEyeColor.Text = emp.EyeColor;1920//load data in textboxes and lists21this.txtFirstName.Text = emp.FirstName;22//other codes goes here23 }
i just wanted to test if i can get the value of the first name, but no luck. hope u can help me on this one. thanks in advance.

Is this code in the server click handler of the modalpopup targetcontrol button? The click event on that is cancelled and the modal popup only shows the popup on the client side. Could you possibly provide some more details on the setup?

Saturday, March 24, 2012

Modal pop-up questions

First, I'd like to display a modal pop-up programatically instead of it being triggered by a button click event or similar.

Secondly, if the user clicks OK, I'd like it to trigger a server-side function.

I've tried several approaches to doing these and have not had much success. Could anyone provide some direction?

Thanks

To show and hide the modal popup programatically:

ModalPopupExtender1.Show() and ModalPopupExtender1.Hide() ' Change "ModalPopupExtender1" to whatever yours is called.

To get your "Okay" button to fire normal server-side code, just don't specify an OkControlID for the ModalPopupExtender. Handle the button's click event normally and just use the above .Hide() method to close the popup.

Modal Popup Window is being closed with every button click

Hello,

I have a weird problem withModalPopupExtender. Every time a press any server sidebutton or link on my modal window themodal window is being closed. Is it normal behavior or I do something wrong ?


I need to implement the following scenario

1. Modal window withuser data is shown on the modal window. There are multiple buttons on the window something like assign location to a user etc….All of them require server side functionality.

Thank you,

Tory

Thank you,

Tory

Hi Tory,

This is expected. ModalPopup closes itself on a full postback - and regular button clicks will cause full postbacks. The solution is to wrap the contents of your ModalPopup inside an UpdatPanel so those other button clicks are just treated as partial postbacks.

Thanks,
Ted

Modal Popup: Will not access event handler in code behind prior to showing modal popup.

I have an AJAX modal popup that is tied to a 'Continue' button on a ASP.NET page. The issue is that I have required field validators with messages next to controls that need to be displayed if information is missing. Right now, the AJAX modal shows upon pressing 'Continue' regardless of if infomration is missing on the page. I put a break point in the event handler for the 'Continue' button and it never even gets hit.

How can I intervene and NOT show the modal popup untilall required field validators are satisfied?

if (Page.IsValid)
modalDialogExtender.Show()
else
//do nuthin


Yes and No. When pressing the button that is the TargetControlID of the modal box, the button event handler of that TargetID is is never reached prior to the modal being displayed. That is the No. However, I added a second hidden control as the TargetControlD that can not be accessed from the page to satisfy the modal's proerties. Then when my 'Continue' button is pressed, Yes, the code you provided works and is hit and the modal is shown programatically (assuming PageIsValid = True).

Thank you for the response.

Modal Popup, Gridview and Updatepanel.

Here is I have.

A Page that has a button (button1), textbox (textbox1), and a modalpopup. The modalpopup extends a panel that has a usercontrol inside it.

Inside the Usercontrol I have some textbox's and a button (button2). And I also have an updatepanel with a gridview inside.
The update panel has a trigger referencing the button (button2). The gridview has a column with a button (selectbutton) inside. I also handle the rowcommand of the gridview to update textbox1 on the page.

When I click button1 the popup shows fine. Then I enter some stuff inside the textbox's for the usercontrol, and then click button2. The gridview updates as expected.

When I click on the button (selectbutton) inside the gridview I set textbox1 on the page to a value from the selectbutton's row and call the hide method of the modalpopup extender...but textbox1 does not update, and the modalpopup does not close.


Any ideas???



Please try your scenario with the recently available61106 release of the Toolkit (and ASP.NET AJAX Beta 2). If the problem persists, then please reply with acomplete, self-contained sample page that demonstrates the problem so that we can investigate the specific behavior you're seeing. Thank you!

Modal Popups and the big ".Show"....(method)

..or what I like to refer to as "You .Show me yours and I'll .Show you mine"..Big Smile

I have a modalpopup tied to a button, which is tied to a Panel and when I click the button
the Panel pops up using :

1) the CSS ModalBackground and,
2) display:none; in the HTML (to keep it from blinking)

Worksperfectly..However..when I invoke the same popup from another button (or DDL) using:

modalpopupextender1.Show

A) the CSS ModalBackground doesn't fire and,Surprise
B) the Panel is non-modal, because of A)Tongue Tied
C) I can't close / hide the Panel Crying

I can still use controls on the main form. This is only if Idon't use :

display:none;

in the HTML. If Ido use: display:none;

in the HTML..the panel never displays..?? Confused
Action Items:
1) Can anyone confirm this? Markup is available.
2) If already known, can you provide the answer?

Regards,

B.Griffin Cool

Hmm... I have used the mpe in similar situation but have never had the problem you seem to be having. Could you please post some code. Also try shwing the modal from javascript instead of a server side function and see if it work then.

When you put the display:none on the panel, are you doing this synamically or on the .aspx source page?


the Display:none is in the source..but I think I found the problem

on my own. It needs to be made clear to people not to mix controls

with that"other AJAX toolkit" . Tongue Tied The Panel and its OK / cancel

can be A#####, if all you ever do is invoke it from anevent (button click).

The extender doesn't care, since both controls inherit from the same control class.

If you're going to invoke it incode (.Show / .Hide) its gotta be Asp:Panel

(etc.)..I tried it..it works..Big Smile

Modal Poup on Page Load

Hi,

Is it possible to conditionally show modal popup on a page load instead on button click?

Before the page load, I have to check from the database if the application is available and if the application is not available then I have to show the modal popup otherwise not.

Please answer with an example.

Thanks

just write the ModalPopup.Show(); on page load.

Thanks

PS If it answers your question, please mark this post as resolved for everyone's benefit.

ModalDialog inside updatepanel

I've got a button that shows a modal dialog box. The idea is to add an object to a database, then refresh a listbox on the main page. The dialog works correctly, except with click cmdOk, the server side function is never called. I suspect it's because there's no longer an event handler registered by JS that calls the script to do the postback. I probably need to create a client side script using OnOkScript="onOK()", but I have no idea how to make the page postback to call cmdNewObject_Click without a full postback. Any ideas?

Thanks,

Rick

<asp:LinkButtonID="cmdAddObject"runat="server"Text="Add Object"></asp:LinkButton>

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

<cc1:ModalPopupPropertiesBackgroundCssClass="modalBackground"OkControlID="cmdOk"CancelControlID="cmdCancel"DropShadow="true"PopupControlID="pnlAddObject"TargetControlID="cmdAddObject"></cc1:ModalPopupProperties>

</cc1:ModalPopupExtender>

<atlas:UpdatePanelID="pnlPopup"runat="server"Mode="conditional">

<Triggers>

<atlas:ControlEventTriggerControlID="cmdOk"EventName="Click"/>

</Triggers>

<ContentTemplate>

<asp:PanelID="pnlAddObject"runat="server"CssClass="modalPopup"Style="display: none">

<div>

<divid="ObjectName">

<asp:TextBoxID="txtObjectName"runat="server"></asp:TextBox></div>

<div>

<divid="OkButton">

<asp:ButtonID="cmdOk"runat="server"OnClick="cmdNewObject_Click"Text="New Object"/></div>

<divid="CancelButton">

<asp:ButtonID="cmdCancel"runat="server"Text="Cancel"/></div>

</div>

</div>

</asp:Panel>

</ContentTemplate>

</atlas:UpdatePanel>

Seethis post and maybe consider removing the OkControlID property so the Ok button can postback normally (thereby dismissing the ModalPopup). I'm thinking you may also want to get rid of the UpdatePanel here as I'm not sure it'll ultimately be necessary.