Databinding within an asp:textbox control

  • Thread starter Luis Esteban Valencia
  • Start date
L

Luis Esteban Valencia

am trying to databind within an asp:textbox control. I have tried many
variations found here but nothing seems to work. It works fine if I use a
regular HTML textbox input though. Here is what I have tried:

<asp:textbox id='<%#DataBinder.Eval(Container.DataItem, "EmailID")%>'
cssclass="textbox" runat="server"><%#DataBinder.Eval(Container.DataItem,
"Email")%></asp:textbox>

I get '<%# DataBinder.Eval(Container.DataItem, "segEmailID").ToString() %>'
is not a valid identifier.

Then

<asp:textbox id="<%#DataBinder.Eval(Container.DataItem, "EmailID")%>"
cssclass="textbox" runat="server"><%#DataBinder.Eval(Container.DataItem,
"Email")%></asp:textbox>

I get 'The server tag is not well formed.'

Finally I tried without the #:

<asp:textbox id='<%DataBinder.Eval(Container.DataItem, "EmailID")%>'
cssclass="textbox" runat="server"><%DataBinder.Eval(Container.DataItem,
"Email")%></asp:textbox>

I get '<%DataBinder.Eval(Container.DataItem, "segEmailID").ToString() %>' is
not a valid identifier.

Thanks for your help! BTW - this asp:textbox control is within a
repeater.....

Thanks again!
 

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,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top