473,322 Members | 1,755 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,322 software developers and data experts.

Validate and save user

Hello,

I am making a page for employees registration.
First, the employee need to submit a password. This is checked in a database
and returns the companyID where this user shold be saved.
Then, I need to show a usercontrol than displays the registration form. This
usercontrol need the companyID as an input.

I need to understand the way for doing this??
Is there possible to set "usercontrol.visible = true" code behind, with an
input (categoryID)? Or is it smart to redirect a new page with the
registrationform (then I need to transfer the companyID to this page, I dont
want to do this in the URL)?

Thsi is the code that find the companyID for this employee:

Private Sub btnVerify_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnVerify.Click
Dim SQL As String = "select customerID from tblCustomer where
password=@password and active = '1'"
Dim conn As New SqlConnection(variables.ConnString)
Dim cmd As New SqlCommand(SQL, conn)
Dim parameter1 As New SqlParameter("@password", Me.txtVerify.Text)
cmd.Parameters.Add(parameter1)

conn.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader

while dr.read
'Show usercontrol with registration form....???? How do i do
this?
end while

conn.Close()

conn.Dispose()
cmd.Dispose()
End Sub

I'm stucked!!!
Jan 23 '06 #1
1 1253
Give the usercontrol a public property for what you need it to show just as
you would any other class. This can then be passed in with an overloaded
constructor,
or set after instantiation, or declaratively in the ASPX portion of the page
with attributes.

See the docs for details:

http://msdn.microsoft.com/library/de...properties.asp

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Øyvind Isaksen" wrote:
Hello,

I am making a page for employees registration.
First, the employee need to submit a password. This is checked in a database
and returns the companyID where this user shold be saved.
Then, I need to show a usercontrol than displays the registration form. This
usercontrol need the companyID as an input.

I need to understand the way for doing this??
Is there possible to set "usercontrol.visible = true" code behind, with an
input (categoryID)? Or is it smart to redirect a new page with the
registrationform (then I need to transfer the companyID to this page, I dont
want to do this in the URL)?

Thsi is the code that find the companyID for this employee:

Private Sub btnVerify_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnVerify.Click
Dim SQL As String = "select customerID from tblCustomer where
password=@password and active = '1'"
Dim conn As New SqlConnection(variables.ConnString)
Dim cmd As New SqlCommand(SQL, conn)
Dim parameter1 As New SqlParameter("@password", Me.txtVerify.Text)
cmd.Parameters.Add(parameter1)

conn.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader

while dr.read
'Show usercontrol with registration form....???? How do i do
this?
end while

conn.Close()

conn.Dispose()
cmd.Dispose()
End Sub

I'm stucked!!!

Jan 23 '06 #2

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

Similar topics

0
by: Kumar | last post by:
Hi , I am using the article code shown in below url: http://www.codeproject.com/aspnet/xmlxsltransformer.asp?df=100&forumid=118504&select=1170328 This article is very cool feature. I...
6
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I don´t know much javascript so I wrote a very simple one to validate a form I have on my webpage. ...
1
by: L Mehl | last post by:
On my cmdSaveRecord, I check a couple of fields to confirm that an entry has been made before allowing the Save. I decided to - not put validation rules in table structure, and - validate on...
9
by: B-Dog | last post by:
I have a form that has about 10 text boxes on it, they all have to be filled out before submitting is there a quick way to make sure that none are null or do I have to call out each textbox? Say...
6
by: KMZ_state | last post by:
We have a debate here. We are receiving a CSV file specified by the user and need to validate the contents, writing the "good" records to the database and displaying the "bad" records to the user....
3
by: Jeff Jarrell | last post by:
I have one textbox on a form. Nothing else. The validate event doesn't fire. Drop another textbox on the form and the validate event fires. Set tabstop = false on the 2nd text box and the...
6
by: Steve Ryan | last post by:
can anyone send me to some good examples of edit in place for data frid columns i see dot net let me assign a control in the IDE any good sources of reading on editing columns with controls...
29
parshupooja
by: parshupooja | last post by:
Hi, I am working in Asp.Net 2.0, SQL Server, C#. I am trying to create a User Input form which has lots of fields such as : salutation; Firstname: lastname: address: Zip: Phone:
2
nev
by: nev | last post by:
I'm trying to learn how to save changes in my BindingSource. What is Me.Validate()? And do I need it everytime I do save the bindingsource? Is this correct? me.validate() '<-- What is this for?...
3
by: OBA | last post by:
Hi To All.... This Is My First Try To Create A Program Which Compose A Server And 2 Client...i Use Access Database As My Back End And Vb6 As My Front End... Problem 1. I Create A Code In...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.