How To Load Gridview in TabPanel


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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ucAjaxTookit" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
  <title>Untitled Page</title>
</head>
<body>
  <form id="form1" runat="server">
  <asp:ScriptManager ID="smScriptManager" runat="server" EnableViewState="False" />
  <div>
      <asp:UpdatePanel ID="upDataUpdate" runat="server" EnableViewState="False">
          <ContentTemplate>
              <asp:PlaceHolder ID="holder" runat="server"></asp:PlaceHolder>
          </ContentTemplate>
      </asp:UpdatePanel>
  </div>
  </form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using AjaxControlToolkit;

public partial class _Default : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {




  }


  protected void Page_Init(object sender, EventArgs e)
  {
      TabContainer tbContainer = new TabContainer();
      for (int n = 1; n <= 3; ++n)
      {
          // Load the control that contains the gridview
          Control ctlGrid = LoadControl("Gridview" + n + ".ascx");

          TabPanel tpPanel = new TabPanel();
          tpPanel.EnableViewState = false;
          tpPanel.HeaderText = "GridView" + n + ".ascx";
          tpPanel.Controls.Add(ctlGrid);
          tbContainer.Controls.Add(tpPanel);
          holder.Controls.Add(tbContainer);

      }
  }
}
Reactions

Post a Comment

4 Comments

  1. what is this holder in this. iam getting error at that place.

    ReplyDelete
  2. Hi Srinivas,
    check this url
    http://aspdotnetcodebook.blogspot.com/2008/04/aspnet-ajax-tabs-control.html

    ReplyDelete
  3. Hi Srinivas,
    Thanks for your comment...i have fixed the bug in the code and also uploaded the source code.

    ReplyDelete

Please do not post any spam link in the comment box😊

Emoji
(y)
:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
x-)
(k)

Close Menu