Loupi
Loupi

Reputation: 1112

Name does not exist in the current context ASP.NET

I was trying to bind a value from an input type text to the gridview but I keep having errors "CS0103: The name 'dateborrowedTextBox' does not exist in the current context"

Date borrowed:
            <%--<asp:TextBox ID="dateborrowedTextBox" runat="server" 
                Text='<%# Bind("dateborrowed") %>' />--%>

            <%--date picker --%>
            <input type="text" runat="server" value='<%# Bind("dateborrowed") %>' name="dateborrowedTextBox" readonly="readonly" id="dateborrowedTextBox" /> 
            <a href="#" onclick="cdp1.showCalendar(this, '<%= dateborrowed.ClientID %>'); return false;">Date Picker</a>       
            <br />

So how can I declare it inside my date picker?

Help would be much appreciated. Thanks in advance.

Upvotes: 0

Views: 4729

Answers (1)

Nathan
Nathan

Reputation: 6216

Your TextBox is commented out - change

<%--<asp:TextBox ID="dateborrowedTextBox" runat="server" 
                Text='<%# Bind("dateborrowed") %>' />--%>

to

<asp:TextBox ID="dateborrowedTextBox" runat="server" 
                Text='<%# Bind("dateborrowed")%>' />

Upvotes: 3

Related Questions