473,943 Members | 6,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 anonymoustempla te). How can I access a
textbox inside the the loggedintemplat e from the code behind c# module?

I tried: (TextBox)Page.F indControl("Tex tBox1") but that will result in a
null pointer.
I also tried:
(TextBox)Page.F indControl("Con tentPlaceHolder 1.LoginView1.Te xtBox1") with the
same result.

Any ideas what I can try next?

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

I have the following problem: I have an asp-page which contains a
loginview with two templates (loggedin- and anonymoustempla te). How
can I access a textbox inside the the loggedintemplat e 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.publi c.dotnet.framew ork.aspnet.
I tried: (TextBox)Page.F indControl("Tex tBox1") but that will result
in a null pointer.
I also tried:
(TextBox)Page.F indControl("Con tentPlaceHolder 1.LoginView1.Te xtBox1")
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 anonymoustempla te). How
can I access a textbox inside the the loggedintemplat e 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.publi c.dotnet.framew ork.aspnet.

I tried: (TextBox)Page.F indControl("Tex tBox1") but that will result
in a null pointer.
I also tried:
(TextBox)Page.F indControl("Con tentPlaceHolder 1.LoginView1.Te xtBox1")
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
1764
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 String Dim myDataListItem As DataListItem Dim myDatagridItem As DataGridItem Dim myCheckBox As CheckBox
0
1056
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 may be over looking? Thanks for any help Private Sub AddRoles() Dim rg As New RoleGroup
3
1648
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
3781
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 error: Control 'loginView' of type 'LoginView' must be placed inside a form tag with runat=server. I can see that the LoginView is indeed being rendered outside the form tag - which seems to surround the content placeholder - so I understand the...
2
8654
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 simple. a label control would be: Label label1 = (Label)loginview1.FindControl("nameoflabel"); then i get to the data that was bound to that control.
1
6444
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? My code is below. Thanks, pj mcdba, mcp
3
4421
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> <asp:LoginName id="loginName" runat="server" FormatString="You are logged in as: {0} | " /> <asp:LoginStatus id="loginStatus" runat="server" LogoutText="logoff" /> <br /> <asp:Label ID="pageContentIsAuth" runat="server" >
0
1061
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 = "New String"; but that dones't work for me. Can anyone help?
7
2309
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 FindControl the only way to do it?
0
10136
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11535
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11126
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11299
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10662
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3512
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.