Lakshmi Narayanan

Lakshmi Narayanan

  • NA
  • 10
  • 14.9k

MultiView in Asp.Net

Jul 7 2011 12:33 AM
Hi Friends,
 I am new for ASP.Net . Now i am looking for ASP.net.I have a doubt.I am using  Multiview Property in my Project.
Design Code:
<%@ 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">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Create Tab Control</title>
    <link id="InstanceStyle" href="StyleSheet.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <fieldset>
<legend>MultiView and View Usage</legend>
<table height="95%" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td style="height: 22px">
<table id="TopTable" runat="server" cellspacing="0" cellpadding="0" width="100%"
border="0">
<tr style="height: 22px">
<td class="SelectedTopBorder" id="Cell1" align="center" style="height: 21px; width: 60px;">
<asp:LinkButton ID="LBView1" runat="server" CssClass="TopTitle" OnClick="LBView1_Click"
Width="105px" Height="16px">Show GridView</asp:LinkButton>
</td>
<td class="SepBorder" width="2px" style="height: 21px">
 </td>
<td class="TopBorder" id="Cell2" align="center" width="60" style="height: 21px">
<asp:LinkButton ID="LBView2" runat="server" CssClass="TopTitle" OnClick="LBView2_Click"
Width="88px" Height="16px">DetailView</asp:LinkButton>
</td>
<td class="SepBorder" width="2px" style="height: 21px">
 </td>
<td class="TopBorder" id="Cell3" align="center" style="width: 60px; height: 21px">
<asp:LinkButton ID="LBView3" runat="server" CssClass="TopTitle" OnClick="LBView3_Click"
Width="89px">Calendar</asp:LinkButton>
</td>
<td class="SepBorder" style="height: 21px">
 </td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table class="ContentBorder" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><br />
<asp:MultiView ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="8" CellPadding="4" Width="515px" OnPageIndexChanging="GridView1_PageIndexChanging" AllowSorting="True" ForeColor="#333333">
<FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <EditRowStyle BackColor="#999999" />
    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
</asp:View>
<asp:View ID="View2" runat="server">
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" BackColor="White"
BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" Height="52px"
Width="362px">
<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
<EditRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<RowStyle BackColor="White" ForeColor="#003399" />
<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
<Fields>
<asp:BoundField DataField="au_id" HeaderText="No" />
<asp:BoundField DataField="phone" HeaderText="phone" />
<asp:BoundField DataField="zip" HeaderText="zip" />
</Fields>
<HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
</asp:DetailsView>
</asp:View>
<asp:View ID="View3" runat="server">
<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="Black" Font-Names="Verdana"
Font-Size="9pt" ForeColor="Black" Height="250px" Width="330px" NextMonthText="Next"
PrevMonthText="previous" SelectedDate="2006-08-15" VisibleDate="2006-08-15"
        SelectMonthText="month" SelectWeekText="week" ShowTitle="False"
        BorderStyle="Solid" CellSpacing="1" NextPrevFormat="ShortMonth">
<SelectedDayStyle BackColor="#333399" ForeColor="White" />
<TodayDayStyle BackColor="#999999" ForeColor="White" />
<OtherMonthDayStyle ForeColor="#999999" />
    <DayStyle BackColor="#CCCCCC" />
<NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
<DayHeaderStyle ForeColor="#333333" Height="8pt" Font-Bold="True" Font-Size="8pt" />
<TitleStyle BackColor="#333399" Font-Bold="True"
Font-Size="12pt" ForeColor="White" Height="12pt" BorderStyle="Solid" />
</asp:Calendar>
</asp:View>
</asp:MultiView>
</td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
    </div>
    </form>
</body>
</html>



void bindata()
    {
        oledbcon = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=D:\\Testing.mdb");
        SelectString = "Select p.ParentName as [ParentName],c.ChildId as [ChildId],c.ChildName as [ChildName],c.price as [Price],c.accept as [Status] from tbl_Parent_header p,tbl_child_header c where p.parentId=c.ParentId order by p.parentName";
        oledbcmd = new OleDbCommand(SelectString, oledbcon);
        try
        {
            oledbcon.Open();
            oledbadapter = new OleDbDataAdapter(oledbcmd);
            DataSet ds = new DataSet();
            oledbadapter.Fill(ds);
            GridView1.DataSource = ds;
            GridView1.DataBind();
            oledbcon.Close();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }

  protected void LBView1_Click(object sender, EventArgs e)
    {
        bindata();
        
    }


 I just fill a information in the Gridview.It is in multiview Property. My doubt is when i click the Tab One Information is not display in the Gridview .Please Clear my Doubt .
Regards,
Lakshmi Narayanan.S


Answers (2)