WebPart ASP.Net Tutorial

<%@ Page Language="VB"%>

    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, _
       ByVal e As System.EventArgs)
      Dim wpDisplayMode As WebParts.WebPartDisplayMode = _
      Webpartmanager1.SupportedDisplayModes(DropDownList1.SelectedValue.ToString())
      Webpartmanager1.DisplayMode = wpDisplayMode
    End Sub
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
      For Each wpMode As WebPartDisplayMode In Webpartmanager1.SupportedDisplayModes            
            Dim modeName As String = wpMode.Name
            Dim dd_ListItem As ListItem = New ListItem(modeName, modeName)
            DropDownList1.Items.Add(dd_ListItem)
      Next
    End Sub



    Web Parts Example


    
        
        
        
            
                
                    

Web Page


                                         LayoutOrientation="Horizontal">
                        
                                                         Title="Welcome to my web page!">
                             Welcome to the page!
                            
                        

                    
                
                
                    Select mode:
                                         AutoPostBack="True" 
                     OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">        
                    
                
            

            
                

                
            
        

                    
                        
                                                         ImageUrl="~/Images/Kids.jpg" Width="150px" 
                             Title="My Kids">
                            
                        

                    
                

                    
                        
                                                         Title="Calendar">