How to import namespace

I have a page(contact_us.aspx) that make use of master (OtherpageMaste

Page 1 of 1

2 Replies - 38084 Views - Last Post: 19 May 2008 - 04:53 PM Rate Topic: -----

#1 chukaeke  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-May 08

How to import namespace

Post icon  Posted 19 May 2008 - 11:08 AM

I have a page(contact_us.aspx) that make use of master (OtherpageMaster.master) and the page has a code behind (contact_us.apsx.vb), i want this page to send a the content of the form via mail, which will require me to import (System.Net.Mail) namespace. Where should i place this <%@ Import Namespace="System.Net.Mail" %>? in the master page code or in the page code or in code behind code. And how do i import this namespace.

Master page code
<%@ Master Language="VB" CodeFile="OtherPageMaster.master.vb" Inherits="Layout_OtherPageMaster" %>
<%@ Import Namespace="System.Net.Mail" %>

contact_us.apsx
<%@ Page Language="VB" MasterPageFile="~/Layout/OtherPageMaster.master" AutoEventWireup="false" CodeFile="contact_us.aspx.vb" Inherits="info_contact_us" title="Jemmc Softech Solutions | Contact Us" %>
<%@ Import Namespace="System.Net.Mail" %>

code behind
Partial Class info_contact_us
	Inherits System.Web.UI.Page

	Protected Sub cmdSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSend.Click
		'
		lblNotice.Text = ""
		txtGuestName.BackColor = Drawing.Color.White
		txtGuestEmail.BackColor = Drawing.Color.White
		'check empty field
		If txtGuestName.Text = "" Then
			'MsgBox("Your name is required")
			txtGuestName.BackColor = Drawing.Color.Pink
			lblNotice.Text = "Your NAME is reqiured"
			txtGuestName.Focus()
			Exit Sub
		End If
		If txtGuestEmail.Text = "" Then
			txtGuestEmail.BackColor = Drawing.Color.Pink
			lblNotice.Text = "Your EMAIL is reqiured"
			txtGuestEmail.Focus()
			Exit Sub
		End If
		'Create mail object
		Dim Msg As Mail
	End Sub
End Class


Is This A Good Question/Topic? 0
  • +

Replies To: How to import namespace

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: How to import namespace

Posted 19 May 2008 - 01:02 PM

In the code-behind.
Was This Post Helpful? 0
  • +
  • -

#3 thor78  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 121
  • Joined: 06-May 08

Re: How to import namespace

Posted 19 May 2008 - 04:53 PM

In your master page code file, ex. MasterPage.master.cs or vb.

Import System.Net.Mail



or

Using System.Net.Mail;


This post has been edited by thor78: 19 May 2008 - 04:54 PM

Was This Post Helpful? 1

Page 1 of 1