Category Archives: MultiView

[RESOLVED] Load another page without page refresh.

I have 2 pages (test1.aspx & test2.aspx). I have one button in test1.aspx, on click of it, I am loading test2.aspx, like Response.Redirect("test2.aspx"). It refreshes the browser/ page and load test2.aspx.

What I have to do is, I have to load test2.aspx without any page/ browser refresh.

 

 

Thanks,

Whenever any brand new page loads , it will refresh the browser.

You may develop  test2.aspx in a UserControl & load it in a UpdatePanel

That I know. I can use iframe too and can set the source of iFrame to test2.aspx, but I am looking for solution without iframe or UserControl.

 

Thanks, 

Not sure but i think ive done something like that with javascript before without it posting back the page

'Build a javascript alert
                'please note the peculiar '/script' in the last line of the script string
                'This is to work around the problem that compiler would mistake the
                'closing script tag as the outer script closing tag.
                Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder
                sb.Append("<script language='javascript'>")
                sb.Append("window.open('alertsAgent.aspx?MU_ID=" & MU_IDstring.ToString & "&Site=" & SiteString.ToString & "&firstname=" & firstnameString.ToString & "&surname=" & surnameString.ToString & "&username=" & usernameString.ToString & "', 'Alerts', 'width=680,height=300,fullscreen=no,scrollbars=1,resizable=0,status=1,dependent=yes,alwaysRaised=yes');{ self.close() };<")
                sb.Append("/script>")


                'register with ClientScript


                Dim t As Type = Me.GetType
                If Not ClientScript.IsClientScriptBlockRegistered(t, "redirectAgentScript") Then
                    ClientScript.RegisterClientScriptBlock(t, "redirectAgentScript", sb.ToString)
                End If


 

You need to take advantage of ASP.NET Ajax partial page refreshing, or use iFrame inside your page to trigger the test2.spx inside your test1.aspx.

Or may be try using JQuery/JTemplate/JSON to load a page w/o flicker. 

Try like this...use HttpWebRequest class, get the html response and then make a jquery call to this function and try to replace the complete form with the html content which you get to jquery....

i never tried it....but there might be performance concerns, i dont know yet...but it might work...

PS - have you tried MultiView control...look at that may be it might fit your requirement...

Thanks.

function LoadPage() {
            window.location = "test2.aspx";
            return false;
        }


// call this function by button client clcik




 <asp:Button ID="btnClick" runat="server" OnClientClick="return LoadPage();" />


You can achieve this same things by javascript function with below code.

[RESOLVED] Dropdownlist click responds is very slow

Hi,

I have a web form which allows users to select a code and the page will then return the corresponding data from the database.

My problem is that the responds to get the data from the database and showing it on the form is extremely slow.

I'm using multiview and update panels. I've tried removing the update panels but it is still slow.

I'm wondering if this is causing the slowness. Other enquiry pages using datagrids are not experiencing this slowness.

This is my first web project.

Thanks.

do one thing while page load just fetch all data and store in session then use this session to get value on 

dorpdown value selecting

This probably isn't anything to do with the form itself. There are a number of things that can affect performance, such as the datbase type, the code used, how much data is returned, etc. Can you post some code and give us more details?

First thing to avoid slowness within round trips is to avoild huge data in Viewstate;

Second, use web methods or page methods to avoid full page postbacks and to render data from client side

[RESOLVED] How do i maintain state of clicked menuitem in menu control

I have menu control like as following:

<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" StaticEnableDefaultPopOutImage="False"
                                                OnMenuItemClick="Menu1_MenuItemClick"  Font-Bold="True" Font-Names="Tahoma" BackColor="Silver">
                                                <Items>
                                                    <asp:MenuItem ImageUrl="Images/selectedtab2011.GIF" Text="" Value="0"></asp:MenuItem>
                                                    <asp:MenuItem ImageUrl="Images/unselectedtab2010.GIF" Text="" Value="1"></asp:MenuItem>
                                                    <asp:MenuItem ImageUrl="Images/unselectedtab2009.GIF" Text="" Value="2"></asp:MenuItem>
                                                    <asp:MenuItem ImageUrl="Images/SRunselectedtab.GIF" Text="" Value="3"></asp:MenuItem>
                                                </Items>
 </asp:Menu>


It gives o/p as tabs: 2011 2010 2009 2008


When i click on each tab i am displaying tab corresponding items with MultiView Control as follows:


<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
                                                <asp:View ID="Tab1" runat="server">
                                                <div style="height: 310px; width: 780px; overflow:auto ">
                                                        <asp:DataList ID="dList2011" runat="server" RepeatDirection="Horizontal"
                                                            RepeatColumns="5" onitemdatabound="dList2011_ItemDataBound">
                                                            <ItemTemplate>
                                                                <asp:HyperLink ID="hlnk3" runat="server" ToolTip='<%# Bind("VideoName") %>' NavigateUrl='<%# Eval("ID", "Archives.aspx?ID={0}") %>'>
                                                                    <asp:Image ID="img3" runat="server" Width="150px" Height="100px" ImageUrl='<%# Bind("Thumbnail") %>' />
                                                                </asp:HyperLink>
                                                            </ItemTemplate>
                                                        </asp:DataList>
                                                    </div>
                                                </asp:View>

</asp:MultiView>


Suppose if i click on 2010 tab, it is showing corresponding datalist items well. If i select one of datalist items under this tab, again it is showing "First Tab (2011)"  instead of showing 2010 as highlighted.


How do i maintain the tab state in page round trips after selecting the items under that tab?

ravikirantummala2000

If i select one of datalist items under this tab, again it is showing "First Tab (2011)"  instead of showing 2010 as highlighted.

Are you trying to highlight the selected Menu Item? If so, you have to set MenuItemStyles like this example

<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" StaticEnableDefaultPopOutImage="False"
    OnMenuItemClick="Menu1_MenuItemClick" Font-Bold="True" Font-Names="Verdana" BackColor="#FFFBD6"
    DynamicHorizontalOffset="2" Font-Size="0.8em" ForeColor="#990000" StaticSubMenuIndent="10px">
    <DynamicHoverStyle BackColor="#990000" ForeColor="White" />
    <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
    <DynamicMenuStyle BackColor="#FFFBD6" />
    <DynamicSelectedStyle BackColor="#FFCC66" />
    <StaticHoverStyle BackColor="#990000" ForeColor="White" />
    <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
    <StaticSelectedStyle BackColor="#FFCC66" />

    <Items>
        <asp:MenuItem ImageUrl="Images/selectedtab2011.GIF" Text="" Value="0"></asp:MenuItem>
        <asp:MenuItem ImageUrl="Images/unselectedtab2010.GIF" Text="" Value="1"></asp:MenuItem>
        <asp:MenuItem ImageUrl="Images/unselectedtab2009.GIF" Text="" Value="2"></asp:MenuItem>
        <asp:MenuItem ImageUrl="Images/SRunselectedtab.GIF" Text="" Value="3"></asp:MenuItem>
    </Items>
</asp:Menu>

Menu Items displaying as follows:

2011    2010   2009  2008

When i click on 2010 Menu item. The Items displaying under 2010 with Multiview as follows :

Item1      Item 2   Item3   Item4

Now i cick on "Item 1" the page is showing 2011 menu item as highlighted instead of showing Item list under tab 2010

I need to maintain the tab state as it is even though i selected items under that particular tab

How do i resolve this?

Hi,

ravikirantummala2000

Now i cick on "Item 1" the page is showing 2011 menu item as highlighted instead of showing Item list under tab 2010

I need to maintain the tab state as it is even though i selected items under that particular tab

How do i resolve this?

I would like to suggest you to check the links below for the similar threads which provide some solutions for the same issue.

if the menuitem included a navigateUrl , selected property does not work.

how to highlight the selected asp menu item?

Hope this helps.

[RESOLVED] can we avoid loading time while switching over from one menu item(tab) to another.

Hi members,

 

I have used the following controls in my web page.

       1.Menu 

       2.Multi view 

       3.view 

       4.Gridview

       But my problem is...whenever i clicks on the menu item it loads particular content individually.

       I mean if i click on menuitem1 it takes some time to load Gridview1 , after if when i click on

       menuitem2 again it takes some time to load Gridview2.

 

       Is there is any way to load all the menu items content during first time of  page load.

 So that we can avoid loading  time while switching over from one menu item(tab) to another.I have used the following code

<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" OnMenuItemClick="menu_Main_MenuItemClick" >
         <Items>
             <asp:MenuItem Text="Tab1" Value="0"></asp:MenuItem>
             <asp:MenuItem Text="Tab2" Value="1"></asp:MenuItem>
            <asp:MenuItem Text="Tab3" Value="2"></asp:MenuItem>
            <asp:MenuItem Text="Tab4" Value="3"></asp:MenuItem>
         </Items>
     </asp:Menu>
        
    <asp:MultiView ID="MultiView1" runat="server">
        <asp:View ID="View1" runat="server">
               //Here Gridview1
         
        </asp:View>
        <asp:View ID="View2" runat="server">
                //Here Gridview2
        </asp:View>
        <asp:View ID="View3" runat="server">
                //Here Gridview3
                 
        </asp:View>
    </asp:MultiView>
   protected void Page_Load(object sender, EventArgs e)
    {
            if (!IsPostBack)
        {
            LoadTab1();
            LoadTab2();
            LoadTab3();
            LoadTab4();
            MultiView1.ActiveViewIndex = 0;

        }
    }

    protected void menu_Main_MenuItemClick(object sender, MenuEventArgs e)
    {
        int index = Int32.Parse(e.Item.Value);
        switch (index)
        {
            
            case 0:
                LoadTab1();
                break;
            case 1:
                LoadTab2();
                break;
            case 2:
                LoadTab3();
                break;
            case 3:
                LoadTab4();
                break;

        }

    }

    private void LoadTab1()
    {
        LoadGridview1();
        MultiView1.ActiveViewIndex = 0;
    }

 private void LoadTab2()
    {
        LoadGridview2();
        MultiView1.ActiveViewIndex = 1;
    }

similarly for LoadTab3() and LoadTab4()
 

 

I'm not sure if there's a way to make the MultiView purely client-side.

That aside: You'd have to go to javascript (client-side script) solution that wraps all the grids in divs and your menu would then turn their visibility on or off as appropriate.