Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3460792
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:16:23+00:00 2026-05-18T10:16:23+00:00

I am using Microsoft visual basic 2010 for a asp.net site using c#. I

  • 0

I am using Microsoft visual basic 2010 for a asp.net site using c#.

I am using the asp.net configuration for user registration. I have a comments form which I want to appear only if a user is logged in.

I now there is a toolbox helper thing called Login View which does exactly what I want but as soon as I put a form inside the code won’t compile because it cannot find the textbox fields.

I have the following in NewsArticle.aspx:

<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
      <div class="postcomment">
           <p><a href="/account/Login.aspx">Login</a> or <a href="/account/Register.aspx">register</a> to post a comment.</p>
      </div>
 </AnonymousTemplate>
 <LoggedInTemplate>
      <div class="formcomment">
          <asp:TextBox ID="txtTitle" textMode="SingleLine" runat="server"></asp:TextBox>
          <asp:TextBox ID="txtComment" TextMode="MultiLine" runat="server"></asp:TextBox>
          <asp:Button ID="cmdUpdate" runat="server" Text="Add Comment" onclick="cmdUpdate_Click" />
      </div>
</LoggedInTemplate>

On the NewsArticle.aspx.cs I have:

protected void cmdUpdate_Click(object sender, EventArgs e) {

    // Get user id
    Guid gUser;
    MembershipUser user = Membership.GetUser(Page.User.Identity.Name);
    gUser = (Guid)user.ProviderUserKey;

    // get article id
    int articleid = Convert.ToInt16(Request.QueryString["id"]);

    // Add to db
    FrontendTableAdapters.NewsCommentTableAdapter ta = new FrontendTableAdapters.NewsCommentTableAdapter();
    ta.Insert1(articleid, gUser.ToString(), txtTitle.Text, txtComment.Text);

    // Redirect back to article
    Response.Redirect(String.Format("NewsArticle.aspx?id={0}#comments", articleid));
}

If I take the form out of asp:LoginView it works fine. Inside I get the following:

Error 2 The name 'txtTitle' does not exist in the current context NewsArticle.aspx.cs 59 53 Figmentville
Error 3 The name 'txtComment' does not exist in the current context \NewsArticle.aspx.cs 59 68 Figmentville
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:16:23+00:00Added an answer on May 18, 2026 at 10:16 am

    You cannot directly access txtTitle and txtComment.

    These must be accessed through LoginView control since they are contained in it.

    You should use FindControl method to locate these controls:
    LoginView.FindControl( stringId)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Microsoft Visual Basic 2010 Express. I have a WPF-based project. I
I am using Microsoft Visual Web Developer 2008 Express. I've made an ASP.NET MVC
I am using Microsoft Visual Studio Professional 2010. (Also SQL Management Studio for my
I'm a developer who works on both individual and group projects using Microsoft Visual
How to export pictures in Microsoft Word to TIFF file using Visual Studio Tools
I'm using Microsoft.XMLHTTP to get some information from another server from an old ASP/VBScript
I'm using Visual Basic 6 for a legacy project and it's been working fine.
Background Information: Visual Studio 2010 (.NET Framework 4.0) Informix Server 7.31 Informix ClientSDK 3.50
I have a 2010 project that is targeting .NET v3.5. Inexplicably I can no
I'm a beginner starting to use Microsoft Visual C++ Express 2010 for Windows Programming.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.