473,406 Members | 2,620 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,406 software developers and data experts.

how to access from code-behind a label into CreateUserWizard control?

Ben
Hi,

i have some problem to access from code-behind a label nested into a
CreateWizard control. I use a html-table for align purpose only.
I try to change the text property of the label with ID="UserNameLabel".

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
<WizardSteps>
<asp:CreateUserWizardStep runat="server">
<ContentTemplate>
<table border="0">
<tr><td>Make a new account</td></tr>
<tr><td><asp:Label ID="UserNameLabel"
runat="server">Username:</asp:Label></td>
<td><asp:TextBox ID="UserName"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired"
runat="server">*</asp:RequiredFieldValidator>
</td></tr>
</table>
</ContentTemplate>
</asp:CreateUserWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
My attempt:
----------
Dim lb As New Label
lb = CreateUserWizard1.WizardSteps.Item(4)
(I also tried with Item(0) till 6).

Thanks for help
Ben
Mar 9 '07 #1
4 6051
You might try something like this...

Dim mpUserNameLabel As Label

mpUserNameLabel = CType(usrWelcome.FindControl("UserName"), Label)

If Not mpUserNameLabel Is Nothing Then
mpUserNameLabel.Text = CType(Session("UserName"), String)
End If

usrWelcome is a User Control that I put together that has labels in it.

.... John

"Ben" <bn*@mail.dewrote in message
news:eF****************@TK2MSFTNGP04.phx.gbl...
Hi,

i have some problem to access from code-behind a label nested into a
CreateWizard control. I use a html-table for align purpose only.
I try to change the text property of the label with ID="UserNameLabel".

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
<WizardSteps>
<asp:CreateUserWizardStep runat="server">
<ContentTemplate>
<table border="0">
<tr><td>Make a new account</td></tr>
<tr><td><asp:Label ID="UserNameLabel"
runat="server">Username:</asp:Label></td>
<td><asp:TextBox ID="UserName"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired"
runat="server">*</asp:RequiredFieldValidator>
</td></tr>
</table>
</ContentTemplate>
</asp:CreateUserWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
My attempt:
----------
Dim lb As New Label
lb = CreateUserWizard1.WizardSteps.Item(4)
(I also tried with Item(0) till 6).

Thanks for help
Ben

Mar 9 '07 #2
Ben
Hi John,

it doesn't work.

I tried this:

lb = CType(CreateUserWizard1.FindControl("UserNameLabel "), Label)
lb.Text = "ok"

but i get an error: "Object reference not set to an instance of an object"
.....
"John Kotuby" <jo***@powerlist.comschreef in bericht
news:%2***************@TK2MSFTNGP05.phx.gbl...
You might try something like this...

Dim mpUserNameLabel As Label

mpUserNameLabel = CType(usrWelcome.FindControl("UserName"), Label)

If Not mpUserNameLabel Is Nothing Then
mpUserNameLabel.Text = CType(Session("UserName"), String)
End If

usrWelcome is a User Control that I put together that has labels in it.

... John

"Ben" <bn*@mail.dewrote in message
news:eF****************@TK2MSFTNGP04.phx.gbl...
>Hi,

i have some problem to access from code-behind a label nested into a
CreateWizard control. I use a html-table for align purpose only.
I try to change the text property of the label with ID="UserNameLabel".

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
<WizardSteps>
<asp:CreateUserWizardStep runat="server">
<ContentTemplate>
<table border="0">
<tr><td>Make a new account</td></tr>
<tr><td><asp:Label ID="UserNameLabel"
runat="server">Username:</asp:Label></td>
<td><asp:TextBox ID="UserName"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired"
runat="server">*</asp:RequiredFieldValidator>
</td></tr>
</table>
</ContentTemplate>
</asp:CreateUserWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
My attempt:
----------
Dim lb As New Label
lb = CreateUserWizard1.WizardSteps.Item(4)
(I also tried with Item(0) till 6).

Thanks for help
Ben


Mar 9 '07 #3
And you're sure that the IDof your Wizard Control is 'CreateUserWizard1' and
the ID or your label is 'UserNameLabel'?

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
"Ben" <bn*@mail.dewrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi John,

it doesn't work.

I tried this:

lb = CType(CreateUserWizard1.FindControl("UserNameLabel "), Label)
lb.Text = "ok"

but i get an error: "Object reference not set to an instance of an object"
....
"John Kotuby" <jo***@powerlist.comschreef in bericht
news:%2***************@TK2MSFTNGP05.phx.gbl...
You might try something like this...

Dim mpUserNameLabel As Label

mpUserNameLabel = CType(usrWelcome.FindControl("UserName"), Label)

If Not mpUserNameLabel Is Nothing Then
mpUserNameLabel.Text = CType(Session("UserName"), String)
End If

usrWelcome is a User Control that I put together that has labels in it.

... John

"Ben" <bn*@mail.dewrote in message
news:eF****************@TK2MSFTNGP04.phx.gbl...
Hi,

i have some problem to access from code-behind a label nested into a
CreateWizard control. I use a html-table for align purpose only.
I try to change the text property of the label with ID="UserNameLabel".

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
<WizardSteps>
<asp:CreateUserWizardStep runat="server">
<ContentTemplate>
<table border="0">
<tr><td>Make a new account</td></tr>
<tr><td><asp:Label ID="UserNameLabel"
runat="server">Username:</asp:Label></td>
<td><asp:TextBox ID="UserName"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired"
runat="server">*</asp:RequiredFieldValidator>
</td></tr>
</table>
</ContentTemplate>
</asp:CreateUserWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
My attempt:
----------
Dim lb As New Label
lb = CreateUserWizard1.WizardSteps.Item(4)
(I also tried with Item(0) till 6).

Thanks for help
Ben


Mar 9 '07 #4
Ben
Hi David, thanks for replying.

To be sure, i send you the beginning code as i tested it:

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master"
AutoEventWireup="false" CodeFile="findcontrolnested.aspx.vb"
Inherits="login" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server"><br />
<asp:ValidationSummary ID="val" runat="Server" />

<table style="width:690px;">
<tr>
<td valign="top">
<fieldset style="height: 300px; width: 320px;">
<legend></legend>
<asp:Login ID="Login1" runat="server" UserNameLabelText="username:"
LoginButtonText="Log in" PasswordLabelText="Paswoord:"
PasswordRequiredErrorMessage="Password required." >
</asp:Login>
</fieldset>
</td>
<td valign="top">
<fieldset style="height: 300px; width: 320px;">
<legend></legend>
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" >
<WizardSteps>
<asp:CreateUserWizardStep ID="cuws1" runat="server">
<ContentTemplate>
<table border="0">
<tr>
<td align="center" colspan="2">
Make a new account</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel"
runat="server" AssociatedControlID="UserName">username:</asp:Label></td>
<td>
<asp:TextBox ID="UserName" runat="server"
MaxLength="20"></asp:TextBox>
<asp:RequiredFieldValidator
ID="UserNameRequired" runat="server" ControlToValidate="UserName"
Font-Size="Smaller"
ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
</tr>
...........
</asp:Content>
Mar 10 '07 #5

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

Similar topics

4
by: Si | last post by:
Hi Guys I am using this code to execute an Access VBA function from ASP: strDbName = strDataSource & "data\webjobs.mdb" Set objAccess = Server.CreateObject("Access.Application")...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
63
by: Jerome | last post by:
Hi, I'm a bit confused ... when would I rather write an database application using MS Access and Visual Basic and when (and why) would I rather write it using Visual Studio .Net? Is it as easy...
17
by: Jelmer | last post by:
Hi, I am mildly familiar with ms access developement and I have been asked to port and document a ms access app. I expect the porting (97 to XP) to be fairly straightforward. However documenting...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
0
by: Namratha Shah \(Nasha\) | last post by:
Hey Guys, Today we are going to look at Code Access Security. Code access security is a feature of .NET that manages code depending on its trust level. If the CLS trusts the code enough to...
4
by: bbdobuddy | last post by:
Hi, How do I open a Microsoft Access 2003 form from Visual Basic.net Thanks in advance bbdobuddy
49
by: Mell via AccessMonster.com | last post by:
I created databases on Access 2003 and I want to deploy them to users. My code was also done using 2003. If they have Ms Access 2000 or higher, will they be able to use these dbs with all code,...
0
ADezii
by: ADezii | last post by:
In Tip #12, we showed how to display a Progress Meter within Access by using the SysCmd() Function. By using this same Function, with different Action Arguments, we will now demonstrate how you can...
16
by: John | last post by:
I am looking for VBA code that will work with Access 2003 to enable dragging and dropping a file/folder name from Windows XP Explorer into an Access form's text box. This is a common functionality...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.