Ajax toolkit-modelpopupextender error: SYS. invalidoperationexception: handler was not added throu

Source: Internet
Author: User

SYS. invalidoperationexception: handler was not added through the SYS. UI. domevent. addhandler method...

Cause:

If you place the OK/cancel button of modalpopupextender IN THE updatepanel dialog box, this error is reported.

Solution:

Since modalpopupextender does not allow users to put the OK/cancel control button in updatepanel, you simply do not need to put it. Use show () and hide () to control it ~

That is,

View plaincopy to clipboardprint?

  1. <C0: modalpopupextender id = "Courier" runat = "server" popupcontrolid = "ptool" cancelcontrolid = "btnhide" backgroundcssclass = "modalbackground" targetcontrolid = "hiddenfield3">

<C0: modalpopupextender id = "Courier" runat = "server" popupcontrolid = "ptool" cancelcontrolid = "btnhide" backgroundcssclass = "modalbackground" targetcontrolid = "hiddenfield3">

 

When modelpopupextender is used recently, it always prompts meSYS. invalidoperationexception does not pass SYS. UI. domevent. addhandlerLater, I found that I set cancellcontrolid, but did not set the corresponding event. I controlled it through show and hide on the server side, in this way, the script cannot be found when searching for cancellcontrolid, and is null. The above error will be thrown in the script. Therefore, if we want to control modelpopupextender on the server side, do not set controlid!

 

ModalpopupextenderUse

10:33:17 | category: Asp.net | Tag: | large font size, medium/small subscription

Common attributes:
Targetcontrolid: controls used to trigger the pop-up panel.
Okcontrolid: the confirmation button in the pop-up panel to confirm the new style.
Onokscript: When you click OK, close the style panel and run the script.
Cancelcontrolid: The cancel button in the style panel to cancel the apply style.
Popupdraghandlecontrolid: the control used to trigger the panel in the style panel.
Dropshadow: whether the style panel has shadow. If the value is true, there is a shadow. If the value is false, There is no shadow.
Backgroundcssclass: the CSS style applied in the style panel.

1. Implement a translucent shadow mask
Defines a CSS class and sends it to the backgroundcssclass attribute.

<Style type = "text/CSS">

. Bg

{

Position: absolute;

Z-index: 100;

Top: 0px;

Left: 0px;

Background-color: #000;

Filter: alpha (opacity = 60 );

-Moz-opacity: 0.6;

Opacity: 0.6;

}

</Style>
2. Javascript control display
$ Find ('panel1 ').Hide()
$ Find ('panel1 ').Show()
The premise is that both popupcontrolid and behaviorid are Panel1
3. Background control display
Panel to be popped up

<Asp: Panel id = "PLINFO" runat = "server" borderstyle = "NONE" style = "display: none">
<Asp: updatepanel id = "upnyuejian" runat = "server" rendermode = "inline">
<Contenttemplate>
<! -- Pay attention to this button,ModalpopupextenderYou must have a Host Control -->
<Asp: button id = "btnshowpopup" runat = "server" style = "display: none"/>
<PC3:ModalpopupextenderId = "popctr" cancelcontrolid = "qxyj" targetcontrolid = "btnshowpopup"
Dropshadow = "false" backgroundcssclass = "Modal" popupcontrolid = "PLINFO" runat = "server">
</PC3:Modalpopupextender>
<Div style = "width: 220px; padding: 10px 0px 10px; Border: 1px # 79144a solid;
Line-Height: 20px; font-size: 13px; letter-Spacing: 1px; margin: 20px 20px; Background-color: # FFF;
Text-align: Left; Background-image: URL (img/langu_bg.gif); background-repeat: No-Repeat; ">
<Asp: literal id = "ltrdtcode" runat = "server"> </ASP: literal>
<P style = "font-weight: bold; padding-top: 10px;">
<Span>
<Asp: linkbutton text = "I insist on seeing" cssclass = "LEEA" id = "lbtnjcyj" commandname = "jcyj" runat = "server"
Onclick = "lbtnjcyjclicklee" commandargument = '<% # eval ("ID") %>'>
</ASP: linkbutton>
</Span> <span style = "padding-left: 40px;">
<Asp: linkbutton text = "cancel appointment" runat = "server" cssclass = "LEEA" id = "qxyj"> </ASP: linkbutton>
</Span>
</P>
</Div>
</Contenttemplate>
</ASP: updatepanel>
</ASP: Panel>
Background:
Popctr.Show(); // Display
Popctr.Hide(); // Hide

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.