0

This is my code line: <asp:TextBox Text='<%#DataBinder.Eval(Container.DataItem,"Date", "{0:MM/dd/yyyy}")%>' ID="txtDate" runat="server" placeholder="Date" class="form-control"></asp:TextBox>

It shows error cs1061 "'Control' does not contain a definition for 'DataItem' and no accessible extension method 'DataItem' accepting a first argument of type 'Control' could be found (are you missing a using directive or an assembly reference?)" 

How do I fix it???

Sgg
  • 3
  • 2
  • is this code within a `Repeater` `GridView` or some other data control? Could you please show the complete code of this control? – fubo Nov 18 '22 at 13:53
  • Use EVAL - https://social.msdn.microsoft.com/Forums/en-US/06752f79-0a95-447b-97a9-c69dbb02c5aa/systemwebuicontrol-does-not-contain-a-definition-for-dataitem-and-no-extension-method?forum=aspdotnetajax Your way should still work but just get annoying error. – duerzd696 Nov 18 '22 at 14:03

0 Answers0