Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,274 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,261 people online right now. Registration is fast and FREE... Join Now!




...does not exist in the current context {RESOLVED}

 
Reply to this topicStart new topic

...does not exist in the current context {RESOLVED}

PsychoCoder
10 Oct, 2008 - 08:06 PM
Post #1

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Has anyone ran into this before, and if so how did you resolve it. Here's the scenario, I have this code

csharp

DateTime start = Convert.ToDateTime(StartDate.Text);
DateTime end = Convert.ToDateTime(EndDate.Text);
string title = NewTitle.Text;
int active = Convert.ToInt32(rblIsActive.SelectedValue);


And I get a compilation error saying those controls don't exist crazy.gif , but here they are in the ASPX page

CODE

    <td valign="top">
        <table style="width:100%;" cellpadding="3" cellspacing="0">
            <tr>
    <td style="width: 70px;">
        New Title:</td>
    <td>
        <asp:TextBox ID="NewTitle" runat="server" CssClass="reg_form" Text='<%#Eval("Title") %>' />
    </td>
</tr>
<tr>
    <td>
        Start Date:</td>
    <td>
        <asp:TextBox ID="StartDate" runat="server" CssClass="reg_form" Text='<%#Eval("StartDate") %>' />
        <a href="java script:void(0);return false;" onclick="window.open('../../Popups/PopCalendar.aspx?type=StartDate','cal','width=250,height=225, status=0,menubar=0,location=0,toolbar=0,directories=0;')">
            <img src="../../images/main_images/SmallCalendar.gif" border="0" width="16" height="16"></a>
    </td>
</tr>
<tr>
    <td>
        End Date:</td>
    <td>
        <asp:TextBox ID="EndDate" runat="server" CssClass="reg_form" Text='<%#Eval("EndDate") %>' />
        <a href="java script:void(0);return false;" onclick="window.open('../../Popups/PopCalendar.aspx?type=EndDate','cal','width=250,height=225, status=0,menubar=0,location=0,toolbar=0,directories=0;')">
            <img src="../../images/main_images/SmallCalendar.gif" border="0" width="16" height="16"></a>
    </td>
</tr>
<tr>
    <td valign="top">
        Active:</td>
    <td>
        <asp:RadioButtonList ID="rblIsActive" runat="server">
            <asp:ListItem Value="1" Selected="true" Text="Yes" />
            <asp:ListItem Value="0" Selected="false" Text="No" />
        </asp:RadioButtonList>
    </td>
</tr>


Has anyone seen this/resolved an issue like this before in ASP.NET?
User is offlineProfile CardPM
+Quote Post

Jayman
RE: ...does Not Exist In The Current Context {RESOLVED}
10 Oct, 2008 - 09:45 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 6,926



Thanked: 42 times
Dream Kudos: 500
Expert In: C#, VB.NET, Java

My Contributions
I don't see anything wrong with what you posted.

Is there anything that you didn't include that may be impacting the ability of the page to see the controls?

I typically run into this when using Ajax or having controls within another control. We use a lot of wizards which load user controls that contain all the functionality of our portal. Using the FindControl method is a necessity in these situations, as I am sure you already know. But I had to ask.

Anything like that going on with what you are doing?
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: ...does Not Exist In The Current Context {RESOLVED}
10 Oct, 2008 - 10:22 PM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Not really, I mean these controls are inside an <asp:View control, then again all other controls are as well, and none of them have I ran into this issue before. I'm almost ready to pull my damn hair out, not that I have a lot to pull anyways!

Also, no ajax at all, just simple ,Net server controls blink.gif
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: ...does Not Exist In The Current Context {RESOLVED}
11 Oct, 2008 - 09:16 AM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Anyone have any ideas? I even went as far as to delete the page and recreate it, same thing crazy.gif
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: ...does Not Exist In The Current Context {RESOLVED}
11 Oct, 2008 - 09:42 AM
Post #5

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Issue's resolved. Sometimes I wonder about myself, those controls are inside a DataList so I had to use

csharp

TextBox startDate = (TextBox)EditTag_DL.FindControl("StartDate");
TextBox endDate = (TextBox)EditTag_DL.FindControl("EndDate");
TextBox newTitle = (TextBox)EditTag_DL.FindControl("NewTitle");
CheckBox keepActive = (CheckBox)EditTag_DL.FindControl("KeepActive");


Now I just need to get rid ofthe following error that happens when I click the "Update" button

QUOTE

Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

User is offlineProfile CardPM
+Quote Post

jacobjordan
RE: ...does Not Exist In The Current Context {RESOLVED}
11 Oct, 2008 - 05:43 PM
Post #6

class Me : Perfection
Group Icon

Joined: 11 Jun, 2008
Posts: 1,163



Thanked: 32 times
Dream Kudos: 1625
My Contributions
PsychoCoder, asking a q-q-question??? I didn't think it was p-p-possib-b-ble!! Help! Water! I t-t-think i'm having a st-t-troke!!
User is offlineProfile CardPM
+Quote Post

aie.k
RE: ...does Not Exist In The Current Context {RESOLVED}
24 Nov, 2008 - 01:21 AM
Post #7

New D.I.C Head
*

Joined: 24 Nov, 2008
Posts: 3


My Contributions
QUOTE(PsychoCoder @ 11 Oct, 2008 - 09:42 AM) *

Issue's resolved. Sometimes I wonder about myself, those controls are inside a DataList so I had to use

csharp

TextBox startDate = (TextBox)EditTag_DL.FindControl("StartDate");
TextBox endDate = (TextBox)EditTag_DL.FindControl("EndDate");
TextBox newTitle = (TextBox)EditTag_DL.FindControl("NewTitle");
CheckBox keepActive = (CheckBox)EditTag_DL.FindControl("KeepActive");


Now I just need to get rid ofthe following error that happens when I click the "Update" button

QUOTE

Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.




Hello, stumbled upon this while trying to figure the same happening out, ie. Invalid .... Since I just registered in this forum, I cannot send you a PM and thus choosing to post here. The coding part of this feels a bit tricky and if you could give me an example on how to Register... I would much appreciate it and have a couple of hours to do some other coding smile.gif. Thank you in advance.

Edit: If that is the part to correct, found a blog that says otherwise http://dotnetscribbles.blogspot.com/2006/1...-and-event.html and it feels like I really don't know where to start. Being new here I don't want to give the impression that I want my homework done but any information pointing me in the right direction would make a big difference to my day.

This post has been edited by aie.k: 24 Nov, 2008 - 01:34 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 05:10AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month