Hello

In my success.aspx file, I have:

<asp:Label ID="LblDate" runat="server" class="labelStyle" Text="Label"></asp:Label>

and

<div class="center">
<asp:Label ID="Name" runat="server"></asp:Label>  
you have successfully registered
</div>

and in my success.aspx.vb file, I have:

Code for the date, which works, and then:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        LblDate.Text = ReturnDate()

        If Request("Name") IsNot Nothing Then

            Name.Text = String.Format("{0}, ", Request("Name"))

        End If

    End Sub

Why would I be getting blue underlines under 'LblDate' and 'Name'. VS tells me that 'LblDate' is not declared. It may be
inaccessible due to its protection level (what 'protection level?), while for 'Name', I get: 'Name' is not declared.
File I/O functionality is available in the 'Microsoft.VisualBasic' namespace.

What do those errors mean, please, and how do I correct them?

Go into designer view, refresh and save the page, then go back into code view.

Sometimes the IDE is slow in writing to the .designer file.

I have tried that and then closed down VS and restarted, but the errors are still there. Could it be anything to do with those Imports?

I have:

Imports Microsoft.AspNet.Identity
Imports Microsoft.AspNet.Identity.EntityFramework
Imports Microsoft.AspNet.Identity.Owin
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports Microsoft.Owin.Security
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web.Security
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Data.OleDb

Thanks again.

LblDate looks fine to me, unless you've modified some other parts of the file such as the class information (partial class). The aspx and aspx.vb are tied together by this partial class info.

Also I dont recognize this.. Request("Name"). What is this referring to? Do you have a subroutine called "Request"?

I know that on another thread you mentioned you were new to asp.net. If you get stuck and you want to try to fix your code without modifying what you have, just create another page and test your changes. that way, you dont loose what you have written already. If your new changes, work, copy over the code.

Hello Jorge

When a new user registers the Register.aspx.vb script redirects him to a personalised 'success' page:

 Dim target = String.Format("~/success.aspx?Name={0}", username.Text)
        ' Perform your Redirect '
        Response.Redirect(target, True)

that says 'Joe, you successfully registered', and so in my success.aspx file I have:

 <div class="center">
<asp:Label ID="Name" runat="server"></asp:Label>  
you have successfully registered
</div>

But 'Name' doesn't seem to be working and, in fact, I have just noticed that it doesn't like 'username' in that Redirect.

You are passing "Name" as a querystring parameter. To retreive the value on the target page you do so by...

 Request.QueryString

Thanks for your advice, Jorge. So, something like this where 'Name' is the ID of the Label?

Label.Name() = Request.QueryString["Name"];

Looks like you are running vb so it would be something like...

 Label.Name = Request.QueryString("Name");  

<edit>WRONG.. see my response below... JorgeM</edit>

this would work assuming your URL is something like.../success.aspx?Name=Blueie

Hello Jorge

Yes, I have:

 Dim target = String.Format("~/success.aspx?Name={0}", username.Text)
        'Redirect '
        Response.Redirect(target, True)
    End Sub

I will try it.

Thanks again!

I get an error there, Jorge:

   Label.Name = Request.QueryString("Name");

The error is with Label.Name: 'Name' is not a member of 'System.Web.UI.WebControls.Label'.

In my corresponding aspx file, I have:

<div class="center">

<asp:Label ID="Name" runat="server"></asp:Label>  
you have successfully registered
</div>

In my Imports, I have:

Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls

Should I change the ID if it doesn't like 'Name'?

Sorry, my mistake... your Label control's ID is called name, not label. it should be...

 Name.Text = Request.QueryString("Name");

I pretty much copied your text and pasted it in my response without taking the time to look at what I copied... sorry about that.

My last post deserves a down-vote :-(

You reference your controls in your code behind by ID and then in this case, we want access to its Text property.

Nooooooo! Not at all! You are very helpful.

Unfortunately, with

Name.Text = Request.QueryString("Name");

the error I get is that 'Text' is not a member of 'String'.

The problem seems to be deeper, doesn't it?

Hmmm. I'm not in front of a PC. Maybe Name is a keyword. Can you try using a different value for the iD, try... lblName

Try casting it to a string

Name.Text = (string)Request.QueryString("Name");

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.