Created
August 24, 2015 21:39
-
-
Save mattkruskamp/cc697cf3461e4422c437 to your computer and use it in GitHub Desktop.
Creating Webparts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<asp:WebPartManager ID=“WebPartManager1” runat=“server”> | |
</asp:WebPartManager> | |
<asp:DropDownList ID=“DropDownList1” runat=“server”> | |
</asp:DropDownList> | |
</div> | |
<div> | |
<asp:WebPartZone ID=“WebPartZone1” runat=“server”> | |
</asp:WebPartZone> | |
</div> | |
<div> | |
<asp:WebPartZone ID=“WebPartZone2” runat=“server”> | |
</asp:WebPartZone> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Page_Load(object sender, EventArgs e) | |
{ | |
if (!IsPostBack) | |
{ | |
// Set up the list of options | |
foreach (WebPartDisplayMode mode in this.WebPartManager1.SupportedDisplayModes) | |
// Add an item for each mode | |
this.DropDownList1.Items.Add( | |
new ListItem(mode.Name, mode.Name)); | |
} | |
this.WebPartManager1.DisplayMode = | |
this.WebPartManager1.SupportedDisplayModes[ | |
this.DropDownList1.SelectedValue]; | |
} | |
protected void DropDownList1_SelectedIndexChanged1( | |
object sender, EventArgs e) | |
{ | |
this.WebPartManager1.DisplayMode = | |
this.WebPartManager1.SupportedDisplayModes[ | |
this.DropDownList1.SelectedValue]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<asp:WebPartZone ID=“WebPartZone1” runat=“server”> | |
<ZoneTemplate> | |
<asp:Calendar ID=“Calendar1” runat=“server” /> | |
</ZoneTemplate> | |
</asp:WebPartZone> | |
</div> | |
<div> | |
<asp:WebPartZone ID=“WebPartZone2” runat=“server”> | |
<ZoneTemplate> | |
<asp:Button ID=“Button1” runat=“server” Text=“Button” /> | |
</ZoneTemplate> | |
</asp:WebPartZone> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment