Vincent's profileInfinity aka VincentPhotosBlogLists Tools Help

Blog


    September 22

    ASP.Net 2.0 + Atlas = AJAX

    Just install Atlas, to enable asp.net 2.0 to have AJAX.
     
    Was playing around with ModalPopupExtender, a component in AJAX that come with the Atlas control kit. Looks cool, and suddenly, stuck on how do i invoke the 'Ok' button. The sample was rather simple, a label, a popup and a button to return text into the label as below
     
            <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
            <atlas:UpdatePanel ID="updatePanel2" runat="server" Mode="Always">
                <ContentTemplate>
                    <asp:Label ID="lTest" runat="server" Text="NoneSet"></asp:Label>
                </ContentTemplate>
            </atlas:UpdatePanel>
       
        <atlas:ModalPopupExtender ID="MPE" runat="server">
        <atlas:ModalPopupProperties
            TargetControlID="LinkButton1"
            PopupControlID="Panel1"
            BackgroundCssClass="modalBackground"
            DropShadow="true"
            OkControlID="OkButton"
            OnOkScript="javascript:__doPostBack('OkButton','')"
            CancelControlID="CancelButton" />
        </atlas:ModalPopupExtender>
        <div style="display:none">
            <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Height="100px">
                    <p>Are you sure you want to proceed?
                    <asp:Button ID="OkButton" runat="server" Text="Yes"></asp:Button>
                    <asp:Button ID="CancelButton" runat="server" Text="No"></asp:Button>
                    </p>
            </asp:Panel>
            </div>

        Protected Sub OkButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles OkButton.Click
            lTest.Text = "ok, your wish is my command, i'll proceed now"
        End Sub
     
    The trick seems to be to use a javascript to call the OkButton as below
    javascript:__doPostBack('OkButton','')"
     
    Atlas can be downloaded here, http://atlas.asp.net
    Atlas ToolKit can be downloaded here, http://atlas.asp.net/atlastoolkit
     

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://infinity-pws.spaces.live.com/blog/cns!7CAC7A82B6773414!178.trak
    Weblogs that reference this entry
    • None