error..of type 'TextBox' must be placed inside a form tag with runat=server

R

Rock

You don't need parens around the DataBinder:

<asp:TemplateColumn HeaderText="Validated">
<ItemTemplate>
<asp:textbox id=test
runat="server"
Text='<%#DataBinder.Eval(Container.DataItem,
"Validated") %>'>
</asp:textbox>

</ItemTemplate>
</asp:TemplateColumn>
 
J

Jim

thanks Rock but it still gives the error

Rock said:
You don't need parens around the DataBinder:

<asp:TemplateColumn HeaderText="Validated">
<ItemTemplate>
<asp:textbox id=test
runat="server"
Text='<%#DataBinder.Eval(Container.DataItem,
"Validated") %>'>
</asp:textbox>

</ItemTemplate>
</asp:TemplateColumn>
 
J

Jim

Hi

I placed a checkboxcontrol in a datagrid:

<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 152px; POSITION:
absolute; TOP: 56px"
runat="server" Height="288px" Width="368px">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:TextBox ID="test" Text='<%#(DataBinder.Eval(Container,
DataItem.customerid"))%' Runat=server>
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</form>

the textbox is enclosed by the form tag so what could be wrong?

ch Jim
 
K

Ken Cox [Microsoft MVP]

Hey Jim,

You just need to put the quotes in the right places and not add extras. You
have a quote after customerid" that shouldn't be there. Try this?

<form id="Form1" method="post" runat="server">
<asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 152px;
POSITION: absolute; TOP: 56px"
runat="server" Height="288px" Width="368px">
<columns>
<asp:templatecolumn>
<itemtemplate>
<asp:TextBox ID="test"
Text='<%#(DataBinder.Eval(Container,DataItem.customerid))%>' Runat="server">
</asp:textbox>
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
</form>

Ken
Microsoft MVP [ASP.NET]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top