Registration Form: Design The Registration Form Using Various Controls and Display Entered Information On Label

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3
At a glance
Powered by AI
The document shows code for designing a registration form in ASP.NET using various form controls like textboxes, radio buttons, checkboxes etc. to collect user information and display it on labels.

User information like name, email, gender etc. is collected using form controls like textboxes, radio buttons. On click of submit button, the collected information is displayed on labels.

Form controls like textboxes, radio buttons, checkboxes, dropdowns, listboxes, calendar etc. are used to collect user data like name, email, gender, courses, country, date of birth.

Registration Form

Design the Registration form using various controls and display entered information on Label

Partial Class Registration


Inherits System.Web.UI.Page
Dim courses As String
Dim county As String
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

End Sub

Protected Sub btnregi_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnregi.Click
lblmessage.Text = "Hello " + txtusername.Text + " ! "
lblmessage.Text = lblmessage.Text + " <br/> You have successfuly Registered with
the following details."

'coding for Radiobutton


If rdbmale.Checked Then
lblShowGender.Text = rdbmale.Text
Else
lblShowGender.Text = rdmfemale.Text
End If

' coding for Radiobuttonlist


If rdbgender.SelectedItem.Text = "Male" Then
lblShowGender.Text = rdbgender.SelectedItem.Text
Else
lblShowGender.Text = rdbgender.SelectedItem.Text
End If

Faculty Name: Nayna N Mistry (M.C.A, NET, GSET) Page 1


Sutex Bank College Of Computer Applications and Science
Registration Form
'coding for checkbox
If chkphp.Checked Then
courses = chkphp.Text + " "
End If
If chkasp.Checked Then
courses += chkasp.Text + " "
End If
If chkjava.Checked Then
courses += chkjava.Text
End If

'coding for checkboxlist

Dim i As Integer
For i = 0 To chkcourse.Items.Count - 1
If chkcourse.Items(i).Selected Then
courses += chkcourse.Items(i).Text
End If
Next

Dim j As Integer
For j = 0 To lstcounty.Items.Count - 1
If lstcounty.Items(j).Selected Then
county += lstcounty.Items(j).Text
End If
Next

'code for upload image in Image folder


Dim str As String
str = Server.MapPath("Images")
If FileUpload1.HasFile = True Then
str = str & "\" & FileUpload1.FileName
FileUpload1.SaveAs(str)
Else

End If

‘Display Information on Label

lblShowCourses.Text = courses
lblShowUserName.Text = txtusername.Text
lblShowEmail.Text = txtemailid.Text

'Using dropdownlist
lblcountry.Text = ddlcountry.SelectedItem.Text

'Using listbox
lblcountry2.Text = county

lbldob.Text = Calendar1.SelectedDate.ToShortDateString

End Sub

Protected Sub btnreset_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnreset.Click
txtusername.Text = ""
txtemailid.Text = ""

Faculty Name: Nayna N Mistry (M.C.A, NET, GSET) Page 2


Sutex Bank College Of Computer Applications and Science
Registration Form
rdbmale.Checked = False
rdmfemale.Checked = False
chkphp.Checked = False
chkasp.Checked = False
chkjava.Checked = False

'Coding for selection clear


For i = 0 To chkcourse.Items.Count - 1
If chkcourse.Items(i).Selected Then
chkcourse.Items(i).Selected = False
End If
Next
End Sub
End Class

Faculty Name: Nayna N Mistry (M.C.A, NET, GSET) Page 3


Sutex Bank College Of Computer Applications and Science

You might also like