Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 780.1k

HTML ERROR

Aug 27 2013 1:29 PM
Sir, I am in a ASP.NET Project.

I want your help in finding the error occurred in my program.

I tried my best to find and solve the error. but in vain.

Here the error:-






I later find that the error is in GridView code. Please go through the GridView code and give a solution for this error.

Here the page's html code:-

<div>
         <h1><span style="color:Green; font-size:larger;">C</span>lass</h1>
         </div>
        <asp:MultiView ID="MvClass" runat="server">
        <asp:View ID="v1Class" runat="server">
        <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px"
                    AutoGenerateRows="False" BackColor="White" BorderColor="#999999"
                    BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black"
                    GridLines="Vertical" onitemcommand="DetailsView1_ItemCommand"
                oniteminserting="DetailsView1_ItemInserting"  >
            <FooterStyle BackColor="#CCCCCC" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <Fields>
               
                <asp:TemplateField HeaderText="Class Name">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtEditClassName" runat="server" Text='<%# Bind("className") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtInsertClassName" runat="server" Text='<%# Bind("className") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("className") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="No of Seats">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtEditSeats" runat="server" Text='<%# Bind("noOfseats") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtInsertSeats" runat="server" Text='<%# Bind("noOfseats") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("noOfseats") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowEditButton="True" />
            </Fields>
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="#CCCCCC" />
        </asp:DetailsView>
</asp:View>
<asp:View ID="v2Class" runat="server">
    <asp:GridView ID="dgvClass" runat="server" AutoGenerateColumns="False"
        AllowPaging="True" DataKeyNames="classId" BackColor="White"
        BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3"
        ForeColor="Black" GridLines="Vertical" ShowFooter="True"
        onrowcancelingedit="dgvClass_RowCancelingEdit"
        onrowcommand="dgvClass_RowCommand"
        onselectedindexchanging="dgvClass_SelectedIndexChanging">
        <FooterStyle BackColor="#CCCCCC" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <EmptyDataTemplate>
            <asp:Label ID="Label4" runat="server" Text='<%# "No Records Available" %>'></asp:Label>
        </EmptyDataTemplate>
        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="#CCCCCC" />
        <RowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
        <Columns>
        <asp:TemplateField HeaderText="S.I.No.">
        <ItemTemplate><%#Container.DataItemIndex + 1; %></ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Class Name">
        <ItemTemplate><%#Eval("className")%></ItemTemplate>
        <EditItemTemplate>
        <asp:TextBox ID="txtClassName" runat="server" Text='<%#Eval("className") %>'></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="No of Seats">
            <FooterTemplate>
                <asp:Button ID="btnAddNew" runat="server" Text="Add New" CommandName="Add" />
            </FooterTemplate>
        <ItemTemplate><%#Eval("noOfseats")%></ItemTemplate>
        <EditItemTemplate>
         <asp:TextBox ID="txtNoOfSeats" runat="server" Text='<%#Eval("noOfseats") %>'></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
        <asp:CommandField ButtonType="Image" ShowSelectButton="true" HeaderText="Select" SelectImageUrl="~/Photos/Select.gif"  />
        <asp:CommandField ButtonType="Image" ShowEditButton="true" HeaderText="Edit" EditImageUrl="~/Photos/Update_icon.gif" />
       <asp:CommandField ButtonType="Image" ShowDeleteButton="true" HeaderText="Delete" DeleteImageUrl="~/Photos/Delete_icon.gif" />
        </Columns>
    </asp:GridView>
</asp:View>
  </asp:MultiView>


Answers (3)