locked
Option Strict On disallows late binding RRS feed

  • Question

  • Today I'm getting an error with this code and this code has not changed in years:

               <itemtemplate>

               <%# DataBinder.Eval(Container.DataItem, "Link") %>

               </itemtemplate>

     

    Does anyone have any idea why or what I can do to resolve it?

    Thanks in advance,

    -alejandro

    that has not changed in years:

     

    				            <asp:templatecolumn 
    					            headertext="Link"
    					            sortexpression="Link"
    					            headerstyle-cssclass="datagridSubHeader" 
    					            itemstyle-horizontalalign="left"
    					            headerstyle-horizontalalign="left">
                					
    					            <itemtemplate>
    						            <%# DataBinder.Eval(Container.DataItem, "Link") %>
    					            </itemtemplate>
    
    					            <edititemtemplate>
    						            <asp:textbox runat="server" id="LinkTextBox" style="width:390px;" text='<%# Container.DataItem("Link") %>' />
    					            </edititemtemplate>         
                					       
    				            </asp:templatecolumn>
    

     

     

     

    • Moved by Mark Liu-lxf Monday, October 24, 2011 7:18 AM ASP.net (From:Visual Basic General)
    Thursday, October 20, 2011 3:40 PM

Answers

  • robably you have set in Tools Basic Options Project and solutions VB Defaults Option Strict Off,

    It is hard to find with the code you provided, this in fact classic style asp code insertion. 

    Probably is your dataitem 'Link" not a string.

    Be aware that you have a better chance to hear how to change this in the forum 

    http://forums.asp.net

    This is exactly done the same for all .Net languages in ASP.Net

     


    Success
    Cor
    Thursday, October 20, 2011 3:48 PM
  • Hi Alejandro Trillo,


    Welcome to the MSDN forum.

    This queue is about Visual Basic. I’m afraid that your topic about ASP.Net is off topic here. For better support, I will move this thread to off topic forum. You can post this thread to the correct forum and here is the link: http://forums.asp.net/ . Sorry for any inconvenience.


    Mark lxf [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, October 24, 2011 7:17 AM
  • Place "Option Strict Off" at the top of the code page above the Imports statements.  Leaving Option Strict On for most code will avoid subtle hard to find errors that would be masked with it off.
    Thursday, October 20, 2011 8:51 PM

All replies

  • robably you have set in Tools Basic Options Project and solutions VB Defaults Option Strict Off,

    It is hard to find with the code you provided, this in fact classic style asp code insertion. 

    Probably is your dataitem 'Link" not a string.

    Be aware that you have a better chance to hear how to change this in the forum 

    http://forums.asp.net

    This is exactly done the same for all .Net languages in ASP.Net

     


    Success
    Cor
    Thursday, October 20, 2011 3:48 PM
  • This is set either as Cor said or under the project properties box on the compile tab.

    Renee


    "MODERN PROGRAMMING is deficient in elementary ways BECAUSE of problems INTRODUCED by MODERN PROGRAMMING." Me
    Thursday, October 20, 2011 4:21 PM
  • Place "Option Strict Off" at the top of the code page above the Imports statements.  Leaving Option Strict On for most code will avoid subtle hard to find errors that would be masked with it off.
    Thursday, October 20, 2011 8:51 PM
  • Hi Alejandro Trillo,


    Welcome to the MSDN forum.

    This queue is about Visual Basic. I’m afraid that your topic about ASP.Net is off topic here. For better support, I will move this thread to off topic forum. You can post this thread to the correct forum and here is the link: http://forums.asp.net/ . Sorry for any inconvenience.


    Mark lxf [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, October 24, 2011 7:17 AM