Showing posts with label pops. Show all posts
Showing posts with label pops. Show all posts

Saturday, March 24, 2012

call codebehind onclick function from modal popup

My modal popup extender pops up an asp:panel that has a couple asp:textbox'es and an OK asp:button that I designate as the OKControlID. I've implemented a javascript function called OnOK() that's designated as the OnOkScript in my control extender, and also implemented a Button_Click function for the OK Button in my page codehind. How do I get the codebehind function to get called. My code calls the onOK script and stops.

Thanks!

Short answer:

You can't. The behavior adds a handler for the click event of the button which executes the OnOkScript(). This prevents a postback from occurring, and a postback is what you need to occur in order to call your code behind function.

Long answer: If you use the property "EnablePageMethods='true'" in your script manager, and assign [WebMethod] attribute to your codebehind, you can call that codebehind method from your JS OnOK function.


LSU:

Tried leaving a message for you on your listed website, but it

doesn't allow anonymous comments, and I didn't want to have to

sign up..I have need for this threads concepts, but I tried doing

an MPE.show in my code behind trying to get the MPE to

display as a result of running code, (not a button click) and

get a runtime error.."cmdDelete already has a data item registered."

VS2005 Pro has no problem with the code..am I using it out of

context?..what am I doing wrong?..

Thanks..


LSU.Net:

Short answer:

You can't. The behavior adds a handler for the click event of the button which executes the OnOkScript(). This prevents a postback from occurring, and a postback is what you need to occur in order to call your code behind function.

Long answer: If you use the property "EnablePageMethods='true'" in your script manager, and assign [WebMethod] attribute to your codebehind, you can call that codebehind method from your JS OnOK function.

Haha! Both answers looked "short" to me.Big Smile
It may not work for the poster's case since the CodeBehind is a WebMethod hence static method which is independent from the page object concept and so if there're reference to the page's objects in the code-behind it'll fail. For the original poster, you may have to "cheat" your way to get it to work. Please see this threadhttp://forums.asp.net/thread/1669503.aspx . I hope there'll be support from AJAX client side or we may have to extend the ModalPopup extender.Big Smile


G20:

Thanks for your input ! I haven't had time to read /absorb the details of the

link yet, but will today. George Bernard Shaw said:

"Science is always wrong. It never answers one question without asking

10 more."

Themodal.hide works fine from the code behind.

Themodal.Show is syntactically acceptable in the code behind,

but doesn't. Why? Where is it used? What is it supposed to do?

.Show works fine in my VB / Access apps (ha ha!)

Seriously, I've been looking for a comprehensive source for

the props & methods of AJAX controls..with examples, like

MSDN would be awesome. Then I could be self -reliant.

Any help there?


yeah i have the same problem as you.

I need to fire/call the modalpopup when there is a textchanged event in a textbox.

I have tried everything i can think of jscript wise.

I also dont' get why the modalpopupextender1.show() isn't working...

If you get this figured out could you please post it ? Ill do the same if i can figure it out.

Thanks

CalendarPopup not showing up over PopupControlExtender

I have a panel that is popped up via a PopupControlExtender and inside that panel I have a CalendarExtender that pops up but it is NOT showing up over top of the PopupControlExtender that is already popped up...How can I force the CalendarExtender to pop up over everything?

Thanks, Greg

I got the calendarExtender to work after I took it out of being contained in a UserControl... There must be something buggy with the CalendarExtedner being in a UserControl??

CalendarExtenter in a modal popup shows transparent

Hello,

i try to use a calendar extender inside a panle that is shown as a modal dialog using a modal popup extender. When the calendar pops up the displayed caledar is shown transparent (it has no background) and no animations are shown when switching between months.

Using the same outside a modal popup shows the calendar as usual.

Is a caledarextender not supposed to be used inside a modal popup?

Thanks in advance,

Ralf

This sounds like an issue we were having.

When you run the page, check the HTML source for a tag that looks like this:

<link href="http://links.10026.com/?link=/.../WebResource.axd?d=..." type="text/css" rel="stylesheet" /
(There should be alot of characters following the "d=")

If there is no reference made to WebResource, try putting another CalendarExtender control outside of the panel. This should force ASP.NET to add the reference.

Let me know what happens,
FB


I've looked at over a dozen suggestions to fix this issue. Finally you have the one that works. You are great! Thanks!

Wednesday, March 21, 2012

CalendarExtender z-Index issue

I am using the calendarExtender on a web form and when the calendar pops out it is underneath my drop down box. I tried changing the z-index but it doesnt help. Can anyone help me get around this issue.

Example:

<%

@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default" %>

<%

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

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<

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

<

headrunat="server"><title>Untitled Page</title><linkhref="StyleSheet.css"rel="stylesheet"type="text/css"/>

</

head>

<

body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"/>

<asp:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><div><b>Calendar with an associated button:</b><br/><asp:TextBoxrunat="server"ID="Date5"/><asp:Imagerunat="Server"ID="Image1"ImageUrl="Calendar_scheduleHS.png"/><br/><cc1:CalendarExtenderID="calendarButtonExtender"runat="server"TargetControlID="Date5"PopupButtonID="Image1"CssClass="MyCalendar"/>

<br/><asp:DropDownListID="DropDownList1"runat="server"><asp:ListItem>TEST TEST TEST TEST</asp:ListItem></asp:DropDownList></div></ContentTemplate></asp:UpdatePanel>

</form>

</

body>

</

html>

Thx

Hi claranced,

I just tried this code and it works fine for me. The calendar appears above the dropdown. I'd make sure there's nothing funny going on in your stylesheet.

Thanks,
Ted
I haven't tried your example but I take it your using IE6? This is a bug in IE where by drop down boxes are effectively on a high layer than the web page regardless of z-index (it delegates the drawing of a drop down to Windows). The only work-around I've found is to use an iframe shim behind the element you want to show. A google search for 'iframe shim' will turn turn up plenty of examples.

I am getting the same issue. Did you manage to find a solution? I suspect that my stylesheet may be to blame, as I have done a number of simplified tests and not encountered the same issue.

If you have found a solution, I would be interested to hear what it was.

Regards,

Will Houston


We have a work-around for the IE6 IFRAME thing that should be avoiding a problem here. Ted tried with IE6, so I don't think that's the issue. Could someone please post a simple demonstration of this problem along with the steps necessary to see it? Until we have that, it's hard to say what might be going on.


I havent found a solution. Im using IE6 with SP2. I tried the IFrame workaround but didnt have any luck. I have had multiple people on our team try this with the same result. Here is the simplest example. When I click on the hyperlink the calendar control pops up under the dropdownlist. If anyone has had any luck with the IFrame, I would love to see an example.

<%@. Page Language="VB" AutoEventWireup="false" CodeFile="CalendarTest.aspx.vb" Inherits="CalendarTest" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!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"> .PopCal { z-index: 100; } </style></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:HyperLink ID="HyperLink1" runat="server">Click Here</asp:HyperLink> <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" PopupButtonID="HyperLink1" CssClass="PopCal"> </cc1:CalendarExtender> <br /> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>Item One</asp:ListItem> <asp:ListItem>Item Two</asp:ListItem> </asp:DropDownList> </ContentTemplate> </asp:UpdatePanel> </div> </form></body></html>


The above example works for me in IE6 (using the web developer plugin I checked the IFRAME is there), but I have a more complex situation where it doesn't work (the calendar extender is several UpdatePanels deep and inside an animation popup where I've implemented my own IFRAME workaround - the calendar IFRAME is definately there though, just not working as expected).
I checked the IFrame in my browser as well and it is present, but still not pushing the calendar in front of the dropdownlist.

I also just ran across it, and at the worst time: as I was showing my boss the latest bits of the site i am working on..... I've been in IE7 here on my workstation and he is still on IE6.....

I look forward to an updated toolkit where this is addressed :-)


This thread describes the issue (CSS, not Calendar) and suggests a workaround:http://forums.asp.net/thread/1550925.aspx

David...

Trust me that with this post I mean absolutely no disrepect... i know there's tons and tons of hours into the toolkit so far and it really is an amazing set of controls that could give Yahoo's a run for their money...

But with that said, how can a bug/error-in-code like this get through QA? Is there no one testing it on IE6 just because IE7 became a "critical update" so the teams at MS think the whole world is off of IE6 and it's CSS issues? It's very frustrating to experience these as a developer expecially when there is absolutely no mention of "known issues"where they should be

I've been knee deep, and will continue to trudge through, in all this MS Ajax since the June CTP and up until this point I've just chalked these up "oh well, it's beta (or not even!)", but now that the core is RTM level (andyet still with glaring issues like this), we as developers need more stability and less instances of running over issues like this where it appears that not even one QA person thought about checking this stuff across more than FireFox and IE7

Another example of this is thePre-Compilation error of RC1 (i really fail to see how that got through testing as well), i know that's not your area per se, but we're all expecting more from the whole MS Ajax framework

It's hard for me to post something like this because being a programmer of VB and SQL Server and now MS Ajax has been my life both professionally and personally for the past 8 years, but things are getting worse rather than better it seems... i could point out all sorts of problems that just simply shouldn't be there that stop manay developers dead in their tracks...

I know this isn't probably fair to post this in response to your David, as i know you are just on the Toolkit team and i also know from attending your DevConnection's sessions that you are very excited and dedicated to this Toolkit project, but it's issues like this z-index issue that are just super frustrating to run into


MorningZ,

We make every effort to comprehensively test on IE6 as well as on IE7, Firefox, Sarfari, and now Opera. As I currently understand it, the particular issue under discussion here is no more or less a problem on IE6 than on any other browser. It stems from the CSS rules for z-index, specifically as they relate to specially position-ed elements on a page (see the links from my discussion in the related thread (http://forums.asp.net/thread/1550925.aspx)). As such, a web page must be laid out in a fairly specific manner in order to trigger this problem - and that's not one of the types of layouts we'd tried before the 10123 release. Is that unfortunate? Yes. Is it something we could possibly have tried and discovered? Sure. However, we'll never be able to cover every scenario that every user might possibly come up with no matter how much we try. As it happens in this case, the contributor of the Calendar has replied to that thread with a suggestion that can be applied by users to their web page to customize the styling of the Calendar control and address the issue for their specific scenario. If it works well, we'll add mention of it to the Calendar sample page as you suggest. That's not quite as good as avoiding the problem in the first place, but I hope it's close.

You mention a couple of other issues with ASP.NET AJAX itself - I'm not going to address them here since I'm not on that team and don't have the right context to do so. But one of the things my team is doing with the Toolkit project is releasing updates more often so that we can quickly address issues that come up. Our development practices are a little more relaxed than typical Microsoft teams - but we're also quite a bit more agile because of it. In this case, we're planning an update for this Thursday (about 9 days after our last release) to address some of the more annoying issues that have come up on the Forums. The issue you raised was already on the list for this release. :)

We're listening to your feedback and trying to do what we can to address the issues you raise. Thanks for taking the time to bring this to our attention and share your thoughts here!


David Anson:

As I currently understand it, the particular issue under discussion here is no more or less a problem on IE6 than on any other browser.

I'm not meaning to nitpick or start an argument here but I have to disagree with you on this one (and I think this was part of the point MorningZ was trying to get accross). The issue under discussion here (of the calendar appearing under a drop down box) is ONLY an IE6 issue, it does not occur on any other browser and is initially caused by an IE6 bug, and further by IE6s incorrect CSS handling (not CSS itself).

David Anson:

a web page must be laid out in a fairly specific manner in order to trigger this problem

I'll have to agree with you again here - the page has to be laid out in a fairly specific manner not to trigger this problem. The problem appears to be when the calendar extender is placed inside an absolute or fixed positioned element. For some reason doing this breaks the iframe fix.

As an aside (but still related) doing so also causes the overflow property of the container element to function as 'hidden' in both IE6 and IE7.


Thanks for the great work David. I hope to see a fix soon.
I have put up some detailed documentation on how to skin Calendar and Tabs athttp://community.bennettadelson.com/blogs/rbuckton/archive/2007/02/02/Skinning-model-for-Calendar-and-Tabs-in-Ajax-Control-Toolkit.aspx.

CalendarExtender Pops up underneath Fixed Grid Header

Hi, i've used CalendarExtender in my page. There is a gridview, whos header is Fixed by style, by setting GridHeader position: "relative" & top: "auto".

Now when I click the calendar image the popup goes underneath the GridHeader. Have anyone encountered this, Or may give a solution?

thanks in advance.

Hi,

Can you show a small self-sufficient sample?


Sure I can, Test this & help me with a solution, Plz.
using System;using System.Data;using System.Collections.Generic;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partialclass _Default : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) BindData(); }private void BindData() { List<string> data =new List<string>();for (int i = 0; i < 500; i++) data.Add("Data " + i.ToString()); GridView1.DataSource = data; GridView1.DataBind(); }}
Here's the aspx
 
1<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>23<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">5<html xmlns="http://www.w3.org/1999/xhtml">6<head runat="server">7 <title>Untitled Page</title>8 <style type="text/css">9 table th10 {11 position: relative;12 top: expression(this.parentNode.parentNode.13 parentNode.scrollTop-1);14 }15</style>16</head>17<body>18 <form id="form1" runat="server">19 <asp:ScriptManager ID="ScriptManager1" runat="server" />20 <div>21 <table>22 <tr>23 <td>24 <asp:TextBox ID="txtFromDate" runat="server" Width="60px"></asp:TextBox>25 <asp:ImageButton runat="Server" ID="imgFromDate"26 AlternateText="Click to show calendar" CausesValidation="false" />27 </td>28 </tr>29 <tr>30 <td align="center">31 <div style="overflow: auto; height: 100px;">32 <asp:GridView ID="GridView1" runat="server">33 <HeaderStyle BackColor="AliceBlue" />34 </asp:GridView>35 </div>36 </td>37 </tr>38 <tr>39 <td>40 <ajaxToolkit:CalendarExtender ID="cbeFromDate" runat="server" PopupButtonID="imgFromDate"41 TargetControlID="txtFromDate" Format="dd/MM/yyyy">42 </ajaxToolkit:CalendarExtender>43 </td>44 </tr>45 </table>46 </div>47 </form>48</body>49</html>
 Thanks for the reply. I thought I'd never get a response.

I found that my calendars were going all over the place until I made the positioning absolute. I just made my whole form absolute so you can try that just to see if it works, that might not be pratical for you so you can try changing only the container for your calendar controls to absolute and maybe that will help.

CalendarExtender Pops up below DropDownList - need help

Hi, I've used CalendarExtender with a TextBox. In the next row I had a dropdownList. Now, when I click the imagebutton, the Calender pops-up below the DropDownList.

Can any one help me with this?

Hi,

Please refer to this post: http://forums.asp.net/p/834115/834115.aspx#834115