Webpart ASP.Net

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="WebPartsSample" %>



    Web Parts Sample


    
    

        
        
                                     runat="server" 
                             AutoPostBack="True" 
                             OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"
                             RepeatColumns="3">
            Browse
            Edit
            Catalog
        
        
        
            
                
                
            
            
                
                
            
        

                    
                        
                                                                      runat="server" 
                                          DayNameFormat="Shortest" 
                                          Height="180px" 
                                          Width="200px">
                                
                                
                                
                                
                                
                                
                                
                                
                            
                        

                    
                

                                                         runat="server" 
                                     BorderColor="Navy" 
                                     Font-Names="Verdana"
                                     Padding="6">
                        
                        
                        
                        
                                                                    BorderColor="Navy" 
                                            BorderStyle="Solid"
                                            BorderWidth="1px" 
                                            ForeColor="Red" />
                                                             ForeColor="Navy" 
                                     HorizontalAlign="Center" />
                        
                            
                                Red
                                Green
                                Blue
                            
                        

                                                               BorderStyle="Solid" 
                                       BorderWidth="1px" 
                                       ForeColor="White" />
                        
                        
                                                                BorderColor="Navy" 
                                        BorderWidth="1px" 
                                        Font-Names="Verdana"
                                        Font-Size="0.6em" />
                        
                    
                

                                            Padding="6">
                        
                        
                        
                        
                                                                    BorderStyle="Solid"
                                            BorderWidth="1px" 
                                            ForeColor="Red" />
                        
                        
                            
                                List
                                Of
                                Things
                            
                        

                                                               BorderStyle="Solid" 
                                       BorderWidth="1px" 
                                       ForeColor="White" />
                        
                                                                   Font-Underline="False" 
                                           ForeColor="White" />
                                                                BorderColor="Navy" 
                                        BorderWidth="1px" 
                                        Font-Names="Verdana"
                                        Font-Size="0.6em" />
                                                                Font-Bold="True" 
                                        Font-Size="0.8em" 
                                        ForeColor="White" />
                    
                

                                                         runat="server" 
                                     BorderColor="Navy" 
                                     Font-Names="Verdana"
                                     Padding="6">
                                                                 BorderColor="#D1DDF1" 
                                         Font-Names="Verdana" 
                                         ForeColor="Red" />
                        
                        
                        
                                                                    BorderColor="Navy" 
                                            BorderStyle="Solid"
                                            BorderWidth="1px" 
                                            ForeColor="Red" />
                                                             ForeColor="Navy" 
                                     HorizontalAlign="Center" />
                        
                            
                        

                        
                        
                        
                                                                BorderColor="Navy" 
                                        BorderWidth="1px" 
                                        Font-Names="Verdana"
                                        Font-Size="0.6em" />
                                                                Font-Bold="True" 
                                        Font-Size="0.8em" ForeColor="White" />
                    
                

    
    

        
            
                
            

        
        
        
    


File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 partial class WebPartsSample : System.Web.UI.Page
{
  protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
  {
    if (this.RadioButtonList1.SelectedValue.ToLower() == "browse")
    {
      this.WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;
    }
    else if (this.RadioButtonList1.SelectedValue.ToLower() == "edit")
    {
      this.WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode;
    }
    else
    {
      this.WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
    }
  }
}