asp.net menu item with out post back

Hello Everyone!

I am using asp.net (Visual Studio 2005) i am using menu control as menu item and multi view to display the content of the each menu code is below

---------------
<asp:Menu ID="Menu1" Width="168px" runat="server" Orientation="Horizontal" StaticEnableDefaultPopOutImage="False" OnMenuItemClick="Menu1_MenuItemClick" ItemWrap="True">
<Items>
<asp:MenuItem ImageUrl="~/selectedtab.GIF" Text=" " Value="0"></asp:MenuItem>
<asp:MenuItem ImageUrl="~/unselectedtab.GIF" Text=" " Value="1"></asp:MenuItem>
</Items>
</asp:Menu>

<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:View ID="Tab1" runat="server" >
<table width="600" cellpadding="0" cellspacing="0">
<tr valign="top">
<td class="TabArea" style="width: 600px">
<br />
<br />
TAB VIEW 1
INSERT YOUR CONENT IN HERE
CHANGE SELECTED IMAGE URL AS NECESSARY
</td>
</tr>
</table>
</asp:View>
<asp:View ID="Tab2" runat="server">
<table width="600" cellpadding="0" cellspacing="0">
<tr valign="top">
<td class="TabArea" style="width: 600px">
<br />
<br />
TAB VIEW 2
INSERT YOUR CONENT IN HERE
CHANGE SELECTED IMAGE URL AS NECESSARY
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
----------------------

-----on the Vb page i have written the code

Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As MenuEventArgs) Handles Menu1.MenuItemClick
MultiView1.ActiveViewIndex = Int32.Parse(e.Item.Value)
Dim i As Integer
'Make the selected menu item reflect the correct imageurl
For i = 0 To Menu1.Items.Count - 1
If i = e.Item.Value Then
Menu1.Items(i).ImageUrl = "selectedtab.gif"
Else
Menu1.Items(i).ImageUrl = "unselectedtab.gif"
End If
Next
End Sub
----------end of the code--------

this code is working very fine on click on each tab its respective page content is displaying

my problem is : on click of each tab page is doing post back which i dont required

so i will be very greatfull if any one can help me to elliminate the post back on the tab click

thanks

pabidi
[3180 byte] By [pabidi] at [2007-11-20 8:47:12]
# 1 Re: asp.net menu item with out post back
Hello,

I wonder if you're using MultiView on a web page? If so, one (and the only) way I know of preventing a full page postback is by using ASP.NET AJAX UpdatePanel (http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx) control.

In your case (after making your web app AJAX-enabled), all you have to do is to enclose your MultiView control inside the UpdatePanel, and declare Menu1 as it's AsyncPostBackTrigger.

Just follow the link I have provided about UpdatePanel, that contains a lot of sample codes on how to use this control.

Best regards :)
cherish at 2007-11-9 11:53:23 >