473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to access asp controls inside a loginview

Hey,

I have the following problem: I have an asp-page which contains a loginview
with two templates (loggedin- and anonymoustemplate). How can I access a
textbox inside the the loggedintemplate from the code behind c# module?

I tried: (TextBox)Page.FindControl("TextBox1") but that will result in a
null pointer.
I also tried:
(TextBox)Page.FindControl("ContentPlaceHolder1.Log inView1.TextBox1") with the
same result.

Any ideas what I can try next?

LLars
Feb 13 '06 #1
2 5813
LLars wrote:
Hey,

I have the following problem: I have an asp-page which contains a
loginview with two templates (loggedin- and anonymoustemplate). How
can I access a textbox inside the the loggedintemplate from the code
behind c# module?
Umm, you don't have an "asp-page": you have an "aspx-page". There is a
difference.

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a newsgroup where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.
I tried: (TextBox)Page.FindControl("TextBox1") but that will result
in a null pointer.
I also tried:
(TextBox)Page.FindControl("ContentPlaceHolder1.Log inView1.TextBox1")
with the same result.

No clue. I have not played with .Net 2.0 yet.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 13 '06 #2
Hey Bob,

thank you for the tip with a better newgroup. I thought asp and general was
the right ony, but I see that your suggestion is a much better one.

By the way, I found out that I can access all controls if I use the
FindControl method on the Masterpage. If the trace directive is set to true,
the structure can be seen. I write this, just in case someone reads the
question and hopes for an answer.

Thanks again Bob.
"Bob Barrows [MVP]" wrote:
LLars wrote:
Hey,

I have the following problem: I have an asp-page which contains a
loginview with two templates (loggedin- and anonymoustemplate). How
can I access a textbox inside the the loggedintemplate from the code
behind c# module?


Umm, you don't have an "asp-page": you have an "aspx-page". There is a
difference.

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a newsgroup where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.

I tried: (TextBox)Page.FindControl("TextBox1") but that will result
in a null pointer.
I also tried:
(TextBox)Page.FindControl("ContentPlaceHolder1.Log inView1.TextBox1")
with the same result.

No clue. I have not played with .Net 2.0 yet.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Feb 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bill yeager | last post by:
I did some more debugging and found the following: 1) I placed the following code in the button event just to see if I could cycle thru the datagrid control collection: <code> Dim strhello As...
0
by: RedEye | last post by:
Hello, I have been looking for a way to add roles to a LoginView control programmatically and it's not working. I have called the sub at init and load and neither work. Does anyone know what I...
3
by: ad | last post by:
I use a LoginView to authenticate user. Can we set the focus in the UserName or Password of the LoginView?
3
by: dmm | last post by:
Hi all, I am using master pages and am having a bit of an issue. As part of my masterpage I want to display the user's current logged in status using the LoginView. However I get the following...
2
by: wikkiwikkiwaa | last post by:
hello, i am trying to access controls inside my formview1 nested inside loginview1. you cannot access the formview1 unless you are properly logged in. for loginview1, that seems to be fairly...
1
by: pj | last post by:
I'm trying to redirect users to another page after they Authenticate with the ASP.NET login controls. The user is able to login, but I can't get the response.redirect to work. Can anyone help? ...
3
by: =?Utf-8?B?am1obWFpbmU=?= | last post by:
When I put asp controls inside the LoginView it removes the codebehind references so that the page will not build. For example: <asp:LoginView ID="LoginView" runat="server" > <LoggedInTemplate>...
0
by: Jacob Donajkowski | last post by:
I want to change the text inside a textbox that is inside a loginview but it won't work using the .findcontrol function. I have tried : textbox tb = loginview1.findcontrol("textbox1"); tb.text =...
7
by: Andy B | last post by:
I have a class I am creating for data access. I need to access controls from inside the class that are on a particular page. How do I do this? or is creating an instance of the page class and using...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.