Newbie Developer
Newbie Developer

Reputation: 125

How to us Ajax Modalpopupextender in usercontrol?

Hi i am studying asp.net webforms and i am now creating usercontrols and trying to use ajaxtoolkit.

On my user Control i copy this code from Ajax-MessageBox Dotnetgurus

    <asp:Button ID="btnD" runat="server" Text="" Style="display: none" Width="0" Height="0" /> 
<AjaxControls:ModalPopupExtender ID="mpeMsg" runat="server" TargetControlID="btnD"
            PopupControlID="pnlMsg" PopupDragHandleControlID="pnlMsgHD" BackgroundCssClass="mpBg"
            DropShadow="true" OkControlID="btnOK">
        </AjaxControls:ModalPopupExtender>

and i want to add Modalpopupextender in it but when i drag it to my btnD an error message box shows.

The operation could not be completed. Invalid FORMATETC structure 
Warning 1   Generation of designer file failed: Unknown server tag 'AjaxControls:ModalPopupExtender'.

There is no > symbol also when i drag new button on the form because of that i cant add extender.

Thanks in Regards

Upvotes: 0

Views: 8663

Answers (2)

Crimsonland
Crimsonland

Reputation: 2204

  1. Add Ajaxtoolkit.dll on your Reference
  2. Reset your Toolbox and Add again Ajaxtoolkit.
  3. Build / Rebuild your Solution

Ajaxtoolkit

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

Regards

Upvotes: 1

airbai
airbai

Reputation: 3966

You need to register the AjaxControlToolKit.dll either in web.config or in your UserControl like:

        <pages validateRequest="false" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
        <controls>
            <add tagPrefix="cc1" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit"/>

or in UserControl like: <%@ Register tagprefix="tagprefix" namespace="namespace" assembly="assembly" %>

Upvotes: 4

Related Questions