2016-04-22 11 views
0

私はgridviewを編集可能にしようとしています。これはデータベースからのデータで満たされます。プログラムが起動すると、データベースに接続してgridviewにデータを入力します。今、私はその中のデータを編集したいです。 ビジュアルスタジオのデザインビューでこのエラーが発生する原因となっている間違いがわかりませんERROR:- Error creating control - GridView1. The server tag is not well formed.コントロール作成エラー - GridView1。サーバーのタグがうまく構成されていない

私が間違っている箇所を見てください。

.aspxの: -

<%@ Page Title="" Language="C#" MasterPageFile="~/AdminHome/AdminMainPage.master" AutoEventWireup="true" CodeFile="questions.aspx.cs" Inherits="AdminHome_questions" %> 
 

 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> 
 
</asp:Content> 
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> 
 

 
    <asp:GridView ID="GridView1" Width="100%" runat="server" AutoGenerateColumns = "false" 
 
AllowPaging = "true" PageSize = "10" Font-Names = "Arial" 
 
Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B" 
 
HeaderStyle-BackColor = "green" OnPageIndexChanging = "OnPaging"> 
 
<Columns> 
 
    <asp:TemplateField ControlStyle-Width="100%" HeaderText="Questions"> 
 
     
 

 
     <ItemTemplate> 
 
      
 

 
      <asp:Table runat="server" Width="100%"> 
 
       
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <%# Eval("Description") %></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <%# Eval("Question") %></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow > 
 
        <asp:TableCell> 
 
         <%# Eval("Option1") %></asp:TableCell> 
 
        <asp:TableCell> 
 
         <%# Eval("Option2") %></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <%# Eval("Option3") %></asp:TableCell> 
 
        <asp:TableCell> 
 
         <%# Eval("Option4") %></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <%# Eval("CorrectAns") %></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <%# Eval("Explanation") %></asp:TableCell> 
 
       </asp:TableRow> 
 
      </asp:Table> 
 
        
 

 
     </ItemTemplate> 
 
     <EditItemTemplate> 
 
      <asp:Table runat="server" Width="100%"> 
 
       
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text="<%# Eval("Description")%>"></asp:TextBox> </asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text="<%# Eval("Question") %>"></asp:TextBox></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow > 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text="<%# Eval("Question") %>"></asp:TextBox></asp:TableCell> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text="<%# Eval("Option2") %>"></asp:TextBox></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text="<%# Eval("Option3") %>"></asp:TextBox></asp:TableCell> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text="<%# Eval("Option4") %>"></asp:TextBox></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text="<%# Eval("CorrectAns") %>"></asp:TextBox></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text="<%# Eval("Explanation") %>"></asp:TextBox></asp:TableCell> 
 
       </asp:TableRow> 
 
      </asp:Table> 
 
     </EditItemTemplate> 
 
    </asp:TemplateField> 
 

 

 
<asp:TemplateField ControlStyle-Width="100%"> 
 
     
 

 
     <HeaderTemplate> 
 
Sections 
 
<asp:DropDownList runat="server" OnSelectedIndexChanged = "SectionChanged" AutoPostBack = "true" 
 
      AppendDataBoundItems = "true"> 
 
       <asp:ListItem Text = "ALL" Value = "ALL"></asp:ListItem> 
 
      <asp:ListItem Text = "Top 10" Value = "10"></asp:ListItem> 
 

 
      </asp:DropDownList> 
 
</HeaderTemplate> 
 
<ItemTemplate> 
 
<%# Eval("SectionName") %> 
 
</ItemTemplate> 
 
<EditItemTemplate> 
 
<asp:TextBox ID="txtPageDesc" runat="Server" TextMode="MultiLine" Rows="10" Columns="50" 
 

 
           Text='<%# Eval("SectionName") %>'></asp:TextBox> 
 
</EditItemTemplate> 
 
</asp:TemplateField> 
 

 
    </Columns> 
 
     </asp:GridView> 
 

 
</asp:Content>

答えて

1

データバインディングを使用すると、テキスト= "<%の#エバール( "説明")%>"ではなく、テキスト= を書くテキストボックスにはしばらく'<%#エバール( "説明")%>'

代わりの""書き込み''

すべてのTextBoxと同じです。私はどのように愚かな

<%@ Page Title="" Language="C#" MasterPageFile="~/AdminHome/AdminMainPage.master" AutoEventWireup="true" CodeFile="questions.aspx.cs" Inherits="AdminHome_questions" %> 
 

 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> 
 
</asp:Content> 
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> 
 

 
    <asp:GridView ID="GridView1" Width="100%" runat="server" AutoGenerateColumns = "false" 
 
AllowPaging = "true" PageSize = "10" Font-Names = "Arial" 
 
Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B" 
 
HeaderStyle-BackColor = "green" OnPageIndexChanging = "OnPaging"> 
 
<Columns> 
 
    <asp:TemplateField ControlStyle-Width="100%" HeaderText="Questions"> 
 
     
 

 
     <ItemTemplate> 
 
      
 

 
      <asp:Table runat="server" Width="100%"> 
 
       
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <%# Eval("Description") %></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <%# Eval("Question") %></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow > 
 
        <asp:TableCell> 
 
         <%# Eval("Option1") %></asp:TableCell> 
 
        <asp:TableCell> 
 
         <%# Eval("Option2") %></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <%# Eval("Option3") %></asp:TableCell> 
 
        <asp:TableCell> 
 
         <%# Eval("Option4") %></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <%# Eval("CorrectAns") %></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <%# Eval("Explanation") %></asp:TableCell> 
 
       </asp:TableRow> 
 
      </asp:Table> 
 
        
 

 
     </ItemTemplate> 
 
     <EditItemTemplate> 
 
      <asp:Table runat="server" Width="100%"> 
 
       
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text='<%# Eval("Description")%>'></asp:TextBox> </asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text='<%# Eval("Question") %>'></asp:TextBox></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow > 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text='<%# Eval("Question") %>'></asp:TextBox></asp:TableCell> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text='<%# Eval("Option2") %>'></asp:TextBox></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text='<%# Eval("Option3") %>'></asp:TextBox></asp:TableCell> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text='<%# Eval("Option4") %>"></asp:TextBox></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text='<%# Eval("CorrectAns") %>'></asp:TextBox></asp:TableCell> 
 
       </asp:TableRow> 
 
       <asp:TableRow width="100%"> 
 
        <asp:TableCell> 
 
         <asp:TextBox runat="server" text='<%# Eval("Explanation") %>'></asp:TextBox></asp:TableCell> 
 
       </asp:TableRow> 
 
      </asp:Table> 
 
     </EditItemTemplate> 
 
    </asp:TemplateField> 
 

 

 
<asp:TemplateField ControlStyle-Width="100%"> 
 
     
 

 
     <HeaderTemplate> 
 
Sections 
 
<asp:DropDownList runat="server" OnSelectedIndexChanged = "SectionChanged" AutoPostBack = "true" 
 
      AppendDataBoundItems = "true"> 
 
       <asp:ListItem Text = "ALL" Value = "ALL"></asp:ListItem> 
 
      <asp:ListItem Text = "Top 10" Value = "10"></asp:ListItem> 
 

 
      </asp:DropDownList> 
 
</HeaderTemplate> 
 
<ItemTemplate> 
 
<%# Eval("SectionName") %> 
 
</ItemTemplate> 
 
<EditItemTemplate> 
 
<asp:TextBox ID="txtPageDesc" runat="Server" TextMode="MultiLine" Rows="10" Columns="50" 
 

 
           Text='<%# Eval("SectionName") %>'></asp:TextBox> 
 
</EditItemTemplate> 
 
</asp:TemplateField> 
 

 
    </Columns> 
 
     </asp:GridView> 
 

 
</asp:Content>

+0

!そんな愚かな間違いを私はやった。本当にありがとう –

関連する問題