Simplest
Postback to the page from the buttons. Populate and make the
appropriate gridview visible.
Whilst this is simple it will cause the browser to refresh the page on
the postback.
AJAX
Put the buttons and gridviews in an update panel and do the same as
the above.
This has the advantage that there is no "flicker". However, you get
the overhead associated with using an update panel.
JavaScript/jQuery
Populate both gridviews on page load and bind some JavaScript to the
menu items.
This has the advantage that their is no reload of the page but you do
have to send all of the data for both gridviews to the user on the
page load. If you have large data sets then performance would be an
issue.
Hope this helps,
Mark
--
|\ _,,,---,,_ A picture used to be worth a
ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
|,4- ) )-,_. ,\ ( `'-' came television!
'---''(_/--' `-'\_)
Mark Stevens (mark at thepcsite fullstop co fullstop uk)
This message is provided "as is".
Put Menu control, GridView1, and GridView2 on your page. Create menu
items, e.g.
<asp:Menu ID="Menu1" runat="server"
onmenuitemclick="Menu1_MenuItemClick">
<Items>
<asp:MenuItem Text="MenuItem1" Value="MenuItem1">
</asp:MenuItem>
<asp:MenuItem Text="MenuItem2" Value="MenuItem2">
</asp:MenuItem>
</Items>
</asp:Menu>
A method named Menu1_MenuItemClick will be created for you in the code-
behind file for the page, add there following code
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
switch (e.Item.Value)
{
case "MenuItem1":
GridView1.Visible = true;
GridView2.Visible = false;
return;
case "MenuItem2":
GridView1.Visible = false;
GridView2.Visible = true;
return;
}
}
To show initially just one grid, add to the Page_Load method following
code:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
GridView1.Visible = true;
GridView2.Visible = false;
}
}
Hope this helps
I am not sure if you really need to have 25 different gridviews on the
same form. Did you try to use just one gridview and programmatically
set its datasource?