开发者

How can I maximize a webpart in ASP.NET?

开发者 https://www.devze.com 2023-03-31 13:39 出处:网络
I am trying to create an iGoogle like page in .net 3.5 I have written code(in asp.net) to dynamically add usercontrols to 2 webzones.....pretty simple stuff....

I am trying to create an iGoogle like page in .net 3.5

I have written code(in asp.net) to dynamically add usercontrols to 2 webzones.....pretty simple stuff....

what i want to know right now is how do i MAXIMIZE each webzone seperately as in if i click o a button on the title bar it should occupy the whole page and then on mininmizing it should come back to its original state.(kinda like what happens in iGoogle)

Also, if you run the code i am pasting, you will see that on button_click it CREATES a new webzone everytime....and i still cannot figur out how to change the title of the controls form 'UNTITLED'..

I'l go ahead and say i am a novice and a full explanation along with implementable code would be REALLY GREAT :):):)...and i Do Not want to use pre packaged stustuff like dynamic dashboard plugin n the likes....:)

The folllowing is my .cs code

public partial class Process_Flow_Dashboard_Default : System.Web.UI.Page 
{ 



    protected void Page_Load(object sender, EventArgs e) 
    { 
        //done nothing here as I am trying to get the funcionalities of the web part before implementing in the proper page. 
       //probably wrong so please correct me 
    } 



    //The basic idea is that once the page is complete, there will be a multiple check box list with a list of widgets.  
    //the ones which are checked will be added to the page in the zones.a very basic DASHBOARD so to say. 


    protected void btn1_Click(object sender, EventArgs e) 
    { 



        //Getting the usercontrol through my local path(placed it in the same folder, so file n开发者_如何学运维ame was sufficient) 
        UserControl Test = (UserControl)LoadControl("Subtract.ascx"); 



        Test.ID = "test"; 


        GenericWebPart part1 = WebPartManager1.CreateWebPart(Test);//creating first webpart 
        UserControl Add = (UserControl)LoadControl("Test.ascx");//Adding second webcontrol 

        Add.ID = "Add"; 

        GenericWebPart part2 = WebPartManager1.CreateWebPart(Add); 


        //LoadControls(); 
        WebPartManager1.AddWebPart(part1, Zone1, 0);//adding to first webzone. 




        WebPartManager1.AddWebPart(part2, Zone2, 1);//adding to second webzone. 
        WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode;//so that i can move the webparts around from one zone to another. 

        part1.Title.Equals("Zone1");//trying to change the title of the webparts, not working:( 

    } 


}

And this is my aspx code:

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

<!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> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <table id="webTable1" runat="server" width="100%"> 
        <tr> 
            <td> 

                <asp:WebPartManager ID="WebPartManager1" runat="server" Personalization-Enabled="true"> 
                </asp:WebPartManager> 
                <asp:EditorZone ID="EditorZone1" runat="server"> 
                    <ZoneTemplate> 
                        <asp:AppearanceEditorPart ID="AppearanceEditorPart1" runat="server" /> 
                    </ZoneTemplate> 
            </asp:EditorZone> 
            </td> 

        </tr> 
        <tr> 
            <td> 
                <asp:Button ID="btn1" runat="server" Text="Button" OnClick="btn1_Click" /> 
            </td> 
        </tr> 
        <tr> 
            <td> 
                <asp:WebPartZone ID="Zone1" runat="server" Width="100%" DisplayTitle="Zone 1"> 


                </asp:WebPartZone> 
            </td> 
            <td> 
                <asp:WebPartZone ID="Zone2" runat="server" Width="100%" Title="Zone 2"> 
                </asp:WebPartZone> 
            </td> 
        </tr> 
    </table> 
    </form> 
</body> 
</html>
0

精彩评论

暂无评论...
验证码 换一张
取 消