Using ASP.NET AJAX ModelPopupExtender

Simple Poll using ModelPopupExtender in asp .net Ajax:
created an poll for the same and Source Code given below:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>

<!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">
   .BackgroundStyle
   {
      background-color:skyblue;
      filter: alpha(opacity=50);
      opacity: 0.5;
   }
    </style>
</head>
<body>
    <form id="form1" runat="server">
   
  <ajax:ToolkitScriptManager ID="tl" runat="server"></ajax:ToolkitScriptManager>
  <asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>
    <asp:Button ID="Button1" runat="server" Text="Quick Poll" />
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>

<asp:Panel ID="Panel1" runat="server" BackColor="#ffffff"
   BorderColor="#dadada" BorderStyle="Solid" BorderWidth="4px"
   Height="190px" Width="350px" Font-Names="Arial" Font-Size="10pt">
  
   <table cellpadding="10" cellspacing="0" style="width: 100%">
      <tr>
         <td>
            What is your Favorite Programming Language?
         </td>
      </tr>
      <tr>
         <td>
            <asp:RadioButtonList ID="RadioButtonList1" runat="server">
               <asp:ListItem>Java</asp:ListItem>
               <asp:ListItem>VB.NET</asp:ListItem>
               <asp:ListItem>C#</asp:ListItem>
            </asp:RadioButtonList>
         </td>
      </tr>
      <tr>
         <td>
            <asp:Button ID="Button2" runat="server" Text="Submit"
               OnClick="Button2_Click" />
            <asp:Button ID="Button3" runat="server" Text="Cancel" />
         </td>
      </tr>
   </table>

</asp:Panel>
<ajax:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
   PopupControlID="Panel1"
   DropShadow="True"
   TargetControlID="Button1"
   CancelControlID="Button3"
   BackgroundCssClass="BackgroundStyle" />
       </ContentTemplate>
</asp:UpdatePanel>
    </form>
</body>
</html>


VB Code:


Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        ModalPopupExtender1.Hide()
        Label1.Text = RadioButtonList1.SelectedItem.Text
    End Sub
End Class


Ebook Download
View all
Learn
View all