How do I integrate Gridviews in tabpanels

Last post 05-12-2008 6:54 PM by jyllan. 2 replies.

Sort Posts:

  • How do I integrate Gridviews in tabpanels

    05-09-2008, 6:41 PM
    • Loading...
    • jyllan
    • Joined on 01-15-2008, 9:04 AM
    • Posts 49

    I look for information about how to insert Gridviews in tab panels ?

    Like gridview1 placed in tabpanel1 and gridview2 in tabpanel2.

    Specially how to avoid confilcts in the C# codefil, if I for example have
    a page_load statement for each gridview.

    Do anybody know how to do this and maybe know some articles about
    this stuf ??

     Best regard Jyllan

  • Re: How do I integrate Gridviews in tabpanels

    05-10-2008, 6:43 AM
    • Loading...
    • Talib_dotnet
    • Joined on 01-31-2008, 11:02 AM
    • Riyadh , K.S.A
    • Posts 109

    Hi  jyllan ,

    Just  check  out  the  below code , 

    SqlDataAdapter da;

    DataSet ds;

    SqlDataAdapter da1;

    DataSet ds1;

    protected void Page_Load(object sender, EventArgs e)

    {

    string constr = Convert.ToString(System.Configuration.ConfigurationManager.ConnectionStrings["TalibConnectionString2"]);

    SqlConnection con = new SqlConnection(constr);

    try

    {

    con.Open();

    da=
    new SqlDataAdapter("select * from tbluserinfo",con);ds=new DataSet();

    da.Fill(ds);

    da1=new SqlDataAdapter("select * from tblMessage",con);

    ds1=new DataSet();

    da1.Fill(ds1);

    GV1.DataSource=ds;

    GV1.DataBind();

    GV2.DataSource=ds1;

    GV2.DataBind();

    }

    catch(Exception ex)

    {

    Response.Write(ex.Message);

    }

    finally

    {

    con.Close();

    }

    }

     

    Code   for  MarkUp Page  is  as  follows,

    <form id="form1" runat="server">

    <div>

    <asp:ScriptManager ID="ScriptManager1" runat="server" />

    <AjaxControlToolkit:TabContainer ID="TC1" runat="server" ActiveTabIndex="1"

    CssClass="style1" Width="471px">

    <AjaxControlToolkit:TabPanel ID="Pnl1" runat="server" HeaderText="UserInfo">

    <ContentTemplate>

    <asp:GridView ID="GV1" runat="server"></asp:GridView>

    </ContentTemplate>

     

    </AjaxControlToolkit:TabPanel>

    <AjaxControlToolkit:TabPanel ID="Pnl2" runat="server" HeaderText="Message">

    <ContentTemplate>

    <asp:GridView ID="GV2" runat="server"></asp:GridView>

    </ContentTemplate>

     

    </AjaxControlToolkit:TabPanel>

    </AjaxControlToolkit:TabContainer>

     

    </div>

    </form>

     

    Hope this  helps  you.  If  not ,  then  please  let me know... Yes

    Click "Mark As Answer" if it helped you.


    TALIB ALI KHAN
    MCTS
    Welcome to TALIB's World



  • Re: How do I integrate Gridviews in tabpanels

    05-12-2008, 6:54 PM
    Answer
    • Loading...
    • jyllan
    • Joined on 01-15-2008, 9:04 AM
    • Posts 49

    Hi thanks but it did'ent helped me.

    I have found a solution

    if (TabPanel1.Enabled = true)

     {

    .......

    }

    if (TabPanel2.Enabled = true)......

Page 1 of 1 (3 items)