Click here to Skip to main content
15,901,284 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplicationGridDropDown._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">


Welcome to ASP.NET!



To learn more about ASP.NET visit www.asp.net.



You can also find
title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN
.



<asp:gridview id="gvProducts"autogeneratecolumns="False" emptydatatext="No data available."
runat="server" DataKeyNames="ProductID" CssClass="GridViewStyle"
OnRowEditing="gvProducts_RowEditing" DataSourceID="sqlDSProducts" OnRowCancelingEdit="gvProducts_RowCancelingEdit"
onrowupdating="gvProducts_RowUpdating" onrowdatabound="gvProducts_RowDataBound">
<rowstyle cssclass="RowStyle">
<footerstyle cssclass="RowStyle">
<SelectedRowStyle CssClass="SelectedRowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
<alternatingrowstyle cssclass="AltRowStyle">
<editrowstyle cssclass="EditRowStyle">
<columns> <asp:BoundField DataField="ProductID" HeaderText="Product ID" ReadOnly="true">
<HeaderStyle HorizontalAlign="Left" Width="100px"/>

<asp:BoundField DataField="ProductNumber" HeaderText="Product Number" ReadOnly="true">
<HeaderStyle HorizontalAlign="Left" Width="150px"/>

<asp:TemplateField headertext="Product Name">
<HeaderStyle HorizontalAlign="Left" Width="200px" />
<itemstyle horizontalalign="Left" width="200px">
<itemtemplate>
<asp:Label ID="lblProduct" runat="server" Text='<%#Eval("ProductName")%>'>

<edititemtemplate>
<asp:TextBox id="txtProductName" text='<%# Eval("ProductName")%>' runat="server" Width="200px"/>


<asp:TemplateField headertext="Sub Category">
<HeaderStyle HorizontalAlign="Left" Width="100px" />
<itemstyle horizontalalign="Left">
<itemtemplate>
<asp:Label ID="lblSubcategory" runat="server" Text='<%#Eval("SubCategoryName")%>'>

<edititemtemplate>
<asp:DropDownList ID="ddlSubCategories" runat="server">


<asp:TemplateField headertext="Category">
<HeaderStyle HorizontalAlign="Left" Width="150px" />
<itemstyle horizontalalign="Left">
<itemtemplate>
<asp:Label ID="lblCategory" runat="server" Text='<%#Eval("CategoryName")%>'>

<edititemtemplate>
<asp:DropDownList ID="ddlCategories" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlCategories_SelectedIndexChanged">



<asp:TemplateField headertext="Price">
<HeaderStyle HorizontalAlign="Right" Width="80" />
<itemstyle horizontalalign="Right" width="80">
<itemtemplate>
<asp:Label ID="lblListPrice" runat="server" Text='<%#Eval("ListPrice","{0:c}")%>'>

<edititemtemplate>
<asp:TextBox id="txtListPrice" text='<%#Eval("ListPrice")%>' Width="80" runat="server"/>


<asp:TemplateField>
<itemtemplate>
<asp:LinkButton ID="btnedit" runat="server" CommandName="Edit" Text="Edit"/>

<edititemtemplate>
<asp:LinkButton ID="btnupdate" runat="server" CommandName="Update" Text="Update" />
<asp:LinkButton ID="btncancel" runat="server" CommandName="Cancel" Text="Cancel"/>



Posted

1 solution

It's missing end tag.
Add the below tag after btncancel tag
HTML
</asp:gridview>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900