Showing posts with label clicks. Show all posts
Showing posts with label clicks. Show all posts

Wednesday, March 28, 2012

Modal Popup extender doesnt work (fast enough?) if used in a user control?

I created a user web control containing a blue panel which will pop up when user clicks on a text box. I use Modalpopupextender for this purpose. It is very simple!

When I reuse this control in a page, the blue panel shows up for a fraction when the page is loaded. This is very annoying cause I basically can't create my own modal dialog box and reuse for different pages. Is this a bug in the toolkit or do I need to add something to my control?

Thanks

MY CONTROL:

<%@dotnet.itags.org.ControlLanguage="C#"AutoEventWireup="true"CodeFile="TestPopUpBox.ascx.cs"Inherits="Admin_Configuration_TestPopUpBox" %>

<%@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<asp:PanelID="Panel1"runat="server"BackColor="Blue"Height="235px"Style="position: relative"

Width="556px"><asp:TextBoxID="TextBox1"runat="server"Style="position: relative"></asp:TextBox>

</asp:Panel>

PAGE:

<%@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="Test.aspx.cs"Inherits="Admin_Configuration_Test" %>

<%@dotnet.itags.org.RegisterSrc="AddDeviceControl.ascx"TagName="AddDeviceControl"TagPrefix="uc1" %>

<%@dotnet.itags.org.RegisterSrc="TestPopUpBox.ascx"TagName="TestPopUpBox"TagPrefix="uc2" %>

<%@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<div>

<asp:ScriptManagerID="ScriptManager1"runat="server">

</asp:ScriptManager>

This is the page<br/>

<uc2:TestPopUpBoxID="TestPopUpBox1"runat="server"/>

</div>

</form>

</body>

</html>

<cc1:ModalPopupExtenderID="ModalPopupExtender1"runat="server"TargetControlID="TextBox1"PopupControlID="Panel1">

</cc1:ModalPopupExtender>

I found another post which solves my problem.

You have to add "display:none" attribute to the panel style. I guess the code in AJAX control takes some time to iterate through all the controls on the page to find and hide the target panel.

Monday, March 26, 2012

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

ModalDialog Switch Panel content on click

I was wondering if there was a way to change the inner content of the modal panel when the user clicks a certain button. Is this a job for the UpdatePanel?

As it stands, I'm just binding to a TargetControlID, and I can Ok/Cancel, but would like the content to change onOk.

I'm quite new to this whole atlas way of thinking, so I'm not sure how to co-mingle all this client/server stuff.

Any help would be appreciated.

-Ty

Hi,

you can also use the DynamicPopulateExtender to load new content inside a panel.

Regards
Marc André

Wednesday, March 21, 2012

ModalPanel - How can I us AJAX instead of postback to update database ?

I'm new to AJAX and this suite of tools. I have a page that when a user clicks a link button my ModalPanel with various input fields appears. When the user clicks the okay button I want to make an async call instead of having the page post back. I need to be able to call one of my business objects defined in C# so what is the best way to do this?

If you can provide details or even a small example I would appreciate it.

My code behind method looks like this:

void OnClick(...)

{

Broker b = new Broker();

b.name = NameTextBox.Text;

b.account = AccountTextBox.Text;

b.Save();


}

Why not just wrap the modalpopup in an updatepanel and let the page postback? It is easier then to have access to the server controls from the form and have full interaction with the other page elements during the postback in case you want to update other stuff on the page.

What benefits are you looking for by not posting back?

Jason