473,589 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Information from a user control

I have several user controls on a page and I am trying to
get information out of them. The postback is being caused
on the aspx page and not in the user control. I have
tried using a property but I keep getting a message that
the object is not referenced.

What I am trying to do is be information from text boxes
and insert them into a new row in a dataset. The
application has several tabs of information. I have a
button set up so they can save the information at any
interval. 1)Is there a way to run a method on the user
control to save just the information on the user control?
2) If not, then how can I get the information from the
user control.

I have declared the control in my code behind. Thanks in
advance.
Nov 17 '05 #1
6 3124
You can expose additional public properties and methods from your user
control, depending on the approach that you want to take. For example, you
may want to expose a public void SaveData() function that will persist the
relevant data. Alternately, you could put up some public properties (I
wouldn't make your member variables externally accessible) that allow you to
get at the information you need from the control. Remember, a type that
derives from System.Web.UI.U serControl is still a type, and you can extend
them as necessary.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Christophe r Young" <cy****@midf.co m> wrote in message
news:02******** *************** *****@phx.gbl.. .
I have several user controls on a page and I am trying to
get information out of them. The postback is being caused
on the aspx page and not in the user control. I have
tried using a property but I keep getting a message that
the object is not referenced.

What I am trying to do is be information from text boxes
and insert them into a new row in a dataset. The
application has several tabs of information. I have a
button set up so they can save the information at any
interval. 1)Is there a way to run a method on the user
control to save just the information on the user control?
2) If not, then how can I get the information from the
user control.

I have declared the control in my code behind. Thanks in
advance.

Nov 17 '05 #2
Here is the code from the user control method.
Public Sub SaveOrder()

Dim order As New Orders
Dim _OrderData As New OrderData

If
CStr(_OrderData .Tables(OrderDa ta.OrderHistory _TABLE).Rows(0) (OrderData.O
rderID_FIELD)) = "new" Then

_OrderID = order.CreateOrd erID

Dim dr As DataRow =
_OrderData.Tabl es(OrderData.Or derHistory_TABL E).NewRow

dr(OrderData.Or derDate_FIELD) = CDate(Me.Reciev edDate.Text)
dr(OrderData.Or derTypeID_FIELD ) =
Me.dropOrderTyp e.SelectedItem. Value
dr(OrderData.Cu rrencyID_FIELD) =
Me.dropCurrency List.SelectedIt em.Value
dr(OrderData.Pu rchOrderNumber_ FIELD) =
Me.txtPurchaseO rderNum.Text
dr(OrderData.Re qDelDate_FIELD) = CDate(Me.ReqDel vDate.Text)
dr(OrderData.Sp ecialInstructio ns_FIELD) =
Me.txtSpecialIn structions

_OrderData.Tabl es(OrderData.Or derHistory_TABL E).Rows.Add(dr)
Else

End If

End Sub

Here is the code from the aspx page behind.

Imports SulfaTreat.Comm on.Data
Imports SulfaTreat.Busi nessRules

Public Class WebForm1
Inherits System.Web.UI.P age

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

End Sub
Protected WithEvents Button1 As System.Web.UI.W ebControls.Butt on
Protected WithEvents GenInfo As
SulfaTreat.MySu lfaTreat.Online Orders.GeneralI nformation

'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

Session("OrderI D") = "new"
GenInfo.SaveOrd er()

End Sub
End Class

When I try this is the error I get.
Object reference not set to an instance of an object.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3
You have a number of objects occurring, each of which could be a null
reference. You'll have to step through your code and determine where you are
throwing this exception. I don't think it's being thrown at the
GenInfo.SaveOrd er line because at this point all of the objects on the page
will exist and you should hold a valid reference here.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Christophe r Young" <cy****@midf.co m> wrote in message
news:OV******** ******@tk2msftn gp13.phx.gbl...
Here is the code from the user control method.
Public Sub SaveOrder()

Dim order As New Orders
Dim _OrderData As New OrderData

If
CStr(_OrderData .Tables(OrderDa ta.OrderHistory _TABLE).Rows(0) (OrderData.O
rderID_FIELD)) = "new" Then

_OrderID = order.CreateOrd erID

Dim dr As DataRow =
_OrderData.Tabl es(OrderData.Or derHistory_TABL E).NewRow

dr(OrderData.Or derDate_FIELD) = CDate(Me.Reciev edDate.Text)
dr(OrderData.Or derTypeID_FIELD ) =
Me.dropOrderTyp e.SelectedItem. Value
dr(OrderData.Cu rrencyID_FIELD) =
Me.dropCurrency List.SelectedIt em.Value
dr(OrderData.Pu rchOrderNumber_ FIELD) =
Me.txtPurchaseO rderNum.Text
dr(OrderData.Re qDelDate_FIELD) = CDate(Me.ReqDel vDate.Text)
dr(OrderData.Sp ecialInstructio ns_FIELD) =
Me.txtSpecialIn structions

_OrderData.Tabl es(OrderData.Or derHistory_TABL E).Rows.Add(dr)
Else

End If

End Sub

Here is the code from the aspx page behind.

Imports SulfaTreat.Comm on.Data
Imports SulfaTreat.Busi nessRules

Public Class WebForm1
Inherits System.Web.UI.P age

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

End Sub
Protected WithEvents Button1 As System.Web.UI.W ebControls.Butt on
Protected WithEvents GenInfo As
SulfaTreat.MySu lfaTreat.Online Orders.GeneralI nformation

'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

Session("OrderI D") = "new"
GenInfo.SaveOrd er()

End Sub
End Class

When I try this is the error I get.
Object reference not set to an instance of an object.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #4
That is exactly where it is throwing it that is what is what is stumping
me.

Server Error in '/OnlineOrders' Application.
------------------------------------------------------------------------
--------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullRefe renceException: Object reference not
set to an instance of an object.

Source Error:
Line 30:
Line 31: Session("OrderI D") = "new"
Line 32: GenInfo.SaveOrd er()
Line 33:
Line 34: End Sub
Source File: c:\inetpub\wwwr oot\OnlineOrder s\WebForm1.aspx .vb Line:
32

Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
SulfaTreat.MySu lfaTreat.Online Orders.WebForm1 .Button1_Click( Object
sender, EventArgs e) in
c:\inetpub\wwwr oot\OnlineOrder s\WebForm1.aspx .vb:32
System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)

System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.Rai
sePostBackEvent (String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #5
Interesting - well, I can vouch for the fact that it can work, so we just
need to figure out what is different about what you are doing. I don't
"speak" VB.NET, so there are some syntactical differences that aren't
immediately obvious to me. Can you give the (sterilized) source of your aspx
file so we can see the entire picture? Also, as a sanity check, if you put a
breakpoint at that line and then print the value of that control at the
command line, does it return null in the immediate window?

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Christophe r Young" <cy****@midf.co m> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
That is exactly where it is throwing it that is what is what is stumping
me.

Server Error in '/OnlineOrders' Application.
------------------------------------------------------------------------
--------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullRefe renceException: Object reference not
set to an instance of an object.

Source Error:
Line 30:
Line 31: Session("OrderI D") = "new"
Line 32: GenInfo.SaveOrd er()
Line 33:
Line 34: End Sub
Source File: c:\inetpub\wwwr oot\OnlineOrder s\WebForm1.aspx .vb Line:
32

Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
SulfaTreat.MySu lfaTreat.Online Orders.WebForm1 .Button1_Click( Object
sender, EventArgs e) in
c:\inetpub\wwwr oot\OnlineOrder s\WebForm1.aspx .vb:32
System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)

System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.Rai
sePostBackEvent (String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #6
Here are the files

GeneralInformat ion.ascx

<%@ Register TagPrefix="igsc h"
Namespace="Infr agistics.WebUI. WebSchedule"
Assembly="Infra gistics.WebUI.W ebDateChooser.v 1" %>
<%@ Control Language="vb" AutoEventWireup ="false"
Codebehind="Gen eralInformation .ascx.vb"
Inherits="Sulfa Treat.MySulfaTr eat.OnlineOrder s.GeneralInform ation"
TargetSchema="h ttp://schemas.microso ft.com/intellisense/ie5" %>
<%@ Register TagPrefix="date " Namespace="Pete rBlum.DateTextB oxControls"
Assembly="DateT extBoxControls" %>
<asp:validation summary id="svalGeneral Info" Height="16px" Width="152px"
runat="server"> </asp:validations ummary>
<table width="90%"> <!-- style="Z-INDEX: 102; LEFT: 8px; POSITION:
absolute; TOP: 56px">-->
<TR>
<TD noWrap>
<TABLE style="WIDTH: 344px; HEIGHT: 138px">
<TR>
<TD>Order Type:</TD>
<TD><asp:dropdo wnlist id="dropOrderTy pe"
Runat="server"> </asp:dropdownlis t></TD>
</TR>
<TR>
<TD noWrap>Date Received:</TD>
<TD><igsch:webd atechooser id="RecievedDat e" Width="153"
runat="server">
<CalendarLayo ut PrevMonthImageU rl="ig_cal_gray P0.gif"
ShowTitle="Fals e" NextMonthImageU rl="ig_cal_gray N0.gif">
<DayStyle BorderWidth="1p x" BorderColor="#9 09090"
BorderStyle="So lid" BackgroundImage ="ig_cal_light3 .gif"></DayStyle>
<FooterStyle Height="16pt" Font-Size="8pt" ForeColor="#707 070"
BackgroundImage ="ig_cal_light2 .gif"></FooterStyle>
<SelectedDaySty le ForeColor="Blac k"
BackgroundImage ="ig_cal_light2 .gif"></SelectedDayStyl e>
<OtherMonthDayS tyle ForeColor="#909 090"></OtherMonthDaySt yle>
<NextPrevStyl e
BackgroundImage ="ig_cal_light1 .gif"></NextPrevStyle>
<CalendarStyl e BorderWidth="1p x" Font-Size="9pt"
Font-Names="Verdana" BorderColor="Gr ay" BorderStyle="So lid"
ForeColor="#505 050" BackColor="#C0C 0C0"></CalendarStyle>
<TodayDayStyl e ForeColor="Blac k"
BackgroundImage ="ig_cal_light1 .gif"></TodayDayStyle>
<DayHeaderSty le Height="1pt" Font-Size="8pt" Font-Bold="True"
ForeColor="#606 060" BackgroundImage ="ig_cal_light2 .gif"
BackColor="#C0C 0C0"></DayHeaderStyle>
<TitleStyle Height="18pt" Font-Size="10pt" Font-Bold="True"
ForeColor="#606 060" BackgroundImage ="ig_cal_light1 .gif"
BackColor="#E0E 0E0"></TitleStyle>
</CalendarLayout>
<ExpandEffect s ShadowColor="Li ghtGray"></ExpandEffects>
</igsch:webdatech ooser></TD>
</TR>
<TR>
<TD>Currency: </TD>
<TD><asp:dropdo wnlist id="dropCurrenc yList" Width="88px"
runat="server"> </asp:dropdownlis t></TD>
</TR>
<TR>
<TD>Purchase Order #:</TD>
<TD><asp:textbo x id="txtPurchase OrderNum" Width="153px"
runat="server"> </asp:textbox></TD>
</TR>
<TR>
<TD noWrap>Req. Delivery Date:</TD>
<TD><igsch:webd atechooser id="ReqDelvDate " Width="153"
runat="server" NullDateLabel=" ">
<CalendarLayo ut PrevMonthImageU rl="ig_cal_gray P0.gif"
ShowTitle="Fals e" NextMonthImageU rl="ig_cal_gray N0.gif">
<DayStyle BorderWidth="1p x" BorderColor="#9 09090"
BorderStyle="So lid" BackgroundImage ="ig_cal_light3 .gif"></DayStyle>
<FooterStyle Height="16pt" Font-Size="8pt" ForeColor="#707 070"
BackgroundImage ="ig_cal_light2 .gif"></FooterStyle>
<SelectedDaySty le ForeColor="Blac k"
BackgroundImage ="ig_cal_light2 .gif"></SelectedDayStyl e>
<OtherMonthDayS tyle ForeColor="#909 090"></OtherMonthDaySt yle>
<NextPrevStyl e
BackgroundImage ="ig_cal_light1 .gif"></NextPrevStyle>
<CalendarStyl e BorderWidth="1p x" Font-Size="9pt"
Font-Names="Verdana" BorderColor="Gr ay" BorderStyle="So lid"
ForeColor="#505 050" BackColor="#C0C 0C0"></CalendarStyle>
<TodayDayStyl e ForeColor="Blac k"
BackgroundImage ="ig_cal_light1 .gif"></TodayDayStyle>
<DayHeaderSty le Height="1pt" Font-Size="8pt" Font-Bold="True"
ForeColor="#606 060" BackgroundImage ="ig_cal_light2 .gif"
BackColor="#C0C 0C0"></DayHeaderStyle>
<TitleStyle Height="18pt" Font-Size="10pt" Font-Bold="True"
ForeColor="#606 060" BackgroundImage ="ig_cal_light1 .gif"
BackColor="#E0E 0E0"></TitleStyle>
</CalendarLayout>
<ExpandEffect s ShadowColor="Li ghtGray"></ExpandEffects>
</igsch:webdatech ooser></TD>
</TR>
</TABLE>
</TD>
<TD>
<TABLE>
<TR>
<TD>Special Instructions:</TD>
</TR>
<TR>
<TD><asp:textbo x id="txtSpecialI nstructions" Height="114px"
Width="280px" Runat="server" TextMode="Multi Line"></asp:textbox></TD>
</TR>
</TABLE>
</TD>
</TR>
</table>
<date:datetextb oxvalidator id="dvalDateRec eived" runat="server"
ErrorMessage="P lease enter or select a valid date."
Display="None"
ControlToValida te="RecievedDat e"></date:datetextbo xvalidator><dat e:datet
extboxvalidator id="dvalReqDeli vDate" runat="server"
ErrorMessage="P lease enter or select a valid date."
Display="None"
ControlToValida te="ReqDelvDate "></date:datetextbo xvalidator><asp :button
id="Submit" runat="server" Text="Button" Visible="False" ></asp:button>

GeneralInformat ion.ascx.vb
Imports System.Diagnost ics
Imports SulfaTreat.Comm on.Data
Imports SulfaTreat.Busi nessRules

Public Class GeneralInformat ion
Inherits System.Web.UI.U serControl

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

End Sub
Public WithEvents txtSpecialInstr uctions As
System.Web.UI.W ebControls.Text Box
Public WithEvents dropCurrencyLis t As
System.Web.UI.W ebControls.Drop DownList
Public WithEvents txtPurchaseOrde rNum As
System.Web.UI.W ebControls.Text Box
Protected WithEvents dvalReqDelivDat e As
PeterBlum.DateT extBoxControls. DateTextBoxVali dator
Protected WithEvents svalGeneralInfo As
System.Web.UI.W ebControls.Vali dationSummary
Public WithEvents dropOrderType As
System.Web.UI.W ebControls.Drop DownList
Protected WithEvents dvalDateReceive d As
PeterBlum.DateT extBoxControls. DateTextBoxVali dator
Public WithEvents ReqDelvDate As
Infragistics.We bUI.WebSchedule .WebDateChooser
Public WithEvents RecievedDate As
Infragistics.We bUI.WebSchedule .WebDateChooser
Public WithEvents Submit As System.Web.UI.W ebControls.Butt on

'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region

#Region "Enum"

Public Enum CurrencyType As Integer
US
Canadian
End Enum

#End Region

Private _ds As DataSet
Private _OrderData As OrderData
Private _OrderID As String

#Region "Properties "

Public ReadOnly Property OrderID() As String
Get
If Not IsNothing(Sessi on("OrderID")) Then
Return CStr(Session("O rderID"))
Else
Return Nothing
End If
End Get
End Property

Public Property OrderTypeID() As Integer
Get
If dropOrderType.S electedIndex <> -1 Then
Return CInt(dropOrderT ype.SelectedIte m.Value)
Else
dropOrderType.S electedIndex = 0
Return CInt(dropOrderT ype.SelectedIte m.Value)
End If
End Get
Set(ByVal Value As Integer)
dropOrderType.S electedIndex = Value
End Set
End Property

Public Property DateRecieved() As Date
Get
If dvalDateReceive d.IsValid = False Then

SulfaTreat.Syst emSupport.Appli cationLog.Write Error("Please select a
valid date.")
Else
Return CDate(Me.Reciev edDate.Text)
End If
End Get
Set(ByVal Value As Date)
Me.RecievedDate .Value = Value
End Set
End Property

Public Property CurrencyID() As Integer
Get
Return CInt(dropCurren cyList.Selected Item.Value)
End Get
Set(ByVal Value As Integer)
dropCurrencyLis t.SelectedIndex = Value
End Set
End Property

Public Property PurchaseOrderNu m() As String
Get
Return txtPurchaseOrde rNum.Text
End Get
Set(ByVal Value As String)
txtPurchaseOrde rNum.Text = Value
End Set
End Property

Public Property ReqDevliveryDat e() As Date
Get
If Me.dvalReqDeliv Date.IsValid = False Then

SulfaTreat.Syst emSupport.Appli cationLog.Write Error("Please select a
valid date.")
Else
Return CDate(Me.ReqDel vDate.Text)
End If
End Get
Set(ByVal Value As Date)
Me.ReqDelvDate. Value = Value
End Set
End Property

Public Property SpecialInstruct ions() As String
Get
Return txtSpecialInstr uctions.Text
End Get
Set(ByVal Value As String)
txtSpecialInstr uctions.Text = Value
End Set
End Property

Private Property CurrencyList() As DataSet
Get
If Not IsNothing(HttpC ontext.Current. Cache("Currency List"))
Then
Return CType(HttpConte xt.Current.Cach e("CurrencyList "),
DataSet)
Else
Me.LoadCurrency List()
Return _ds
End If
End Get
Set(ByVal Value As DataSet)
HttpContext.Cur rent.Cache("Cur rencyList") = Value
End Set
End Property

Private Property OrderTypeList() As DataSet
Get
If Not IsNothing(HttpC ontext.Current. Cache("OrderTyp eList"))
Then
Return CType(HttpConte xt.Current.Cach e("OrderTypeLis t"),
DataSet)
Else
LoadOrderTypeLi st()
Return _ds
End If
End Get
Set(ByVal Value As DataSet)
HttpContext.Cur rent.Cache("Ord erTypeList") = Value
End Set
End Property

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

If Not IsPostBack Then
Me.RecievedDate .Value = Date.Today
LoadDropLists()
End If

End Sub

Private Sub LoadDropLists()

With Me.dropCurrency List
.DataSource = Me.CurrencyList
.DataTextField = "Currency"
.DataValueField = "CurrencyID "
.DataBind()
End With

With Me.dropOrderTyp e
.DataSource =
Me.OrderTypeLis t.Tables(OrderD ata.OrderTypes_ TABLE)
.DataTextField = OrderData.Order TypeDescription _FIELD
.DataValueField = OrderData.Order TypeID_FIELD
.DataBind()
End With

End Sub

Private Sub LoadCurrencyLis t()

Dim ord As New Orders

_ds = ord.GetCurrency List()

HttpContext.Cur rent.Cache("Cur rencyList") = _ds

End Sub

Private Sub LoadOrderTypeLi st()

Dim ord As New Orders

_ds = ord.GetOrderTyp es()

HttpContext.Cur rent.Cache("Ord erTypeList") = _ds

End Sub

Public Sub Clear()

Me.RecievedDate .Value = Date.Today
Me.dropCurrency List.SelectedIn dex = 0
Me.dropOrderTyp e.SelectedIndex = 0
Me.ReqDelvDate. Value = ""
Me.txtPurchaseO rderNum.Text = ""
Me.txtSpecialIn structions.Text = ""

End Sub

Public Sub SaveOrder()

Dim order As New Orders
Dim _OrderData As New OrderData

If
CStr(_OrderData .Tables(OrderDa ta.OrderHistory _TABLE).Rows(0) (OrderData.O
rderID_FIELD)) = "new" Then

_OrderID = order.CreateOrd erID

Dim dr As DataRow =
_OrderData.Tabl es(OrderData.Or derHistory_TABL E).NewRow

dr(OrderData.Or derDate_FIELD) = CDate(Me.Reciev edDate.Text)
dr(OrderData.Or derTypeID_FIELD ) =
Me.dropOrderTyp e.SelectedItem. Value
dr(OrderData.Cu rrencyID_FIELD) =
Me.dropCurrency List.SelectedIt em.Value
dr(OrderData.Pu rchOrderNumber_ FIELD) =
Me.txtPurchaseO rderNum.Text
dr(OrderData.Re qDelDate_FIELD) = CDate(Me.ReqDel vDate.Text)
dr(OrderData.Sp ecialInstructio ns_FIELD) =
Me.txtSpecialIn structions

_OrderData.Tabl es(OrderData.Or derHistory_TABL E).Rows.Add(dr)
Else

End If

End Sub

Public Sub Submit_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles Submit.Click
SaveOrder()
End Sub
End Class

webform1.aspx

<%@ Register TagPrefix="uc1" TagName="Genera lInformation"
Src="Controls/GeneralInformat ion.ascx" %>
<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Web Form1.aspx.vb"
Inherits="Sulfa Treat.MySulfaTr eat.OnlineOrder s.WebForm1"%>
<%@ Register TagPrefix="uc1" TagName="Custom erInformation"
Src="Controls/CustomerInforma tion.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1 </title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="Visual Basic .NET 7.1" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P>
<uc1:GeneralInf ormation id="GeneralInfo rmation1"
runat="server"> </uc1:GeneralInfo rmation></P>
<P>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button></P>
</form>
</body>
</HTML>

webform1.aspx.v b

Imports SulfaTreat.Comm on.Data
Imports SulfaTreat.Busi nessRules

Public Class WebForm1
Inherits System.Web.UI.P age

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

End Sub
Protected WithEvents Button1 As System.Web.UI.W ebControls.Butt on
Protected WithEvents GenInfo As
SulfaTreat.MySu lfaTreat.Online Orders.GeneralI nformation

'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

Session("OrderI D") = "new"
System.Diagnost ics.Debug.Write (GenInfo.Client ID)
GenInfo.SaveOrd er()

End Sub
End Class
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #7

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

Similar topics

5
1987
by: Michelle A. | last post by:
I have a four page form. Pages 1-3 stores there information in a session variables. Page four is reached (a final review page) and then the information will be written to the SQL server. When I tried to enter some code in the HTML table by hand so I could get it to show up in the right place. For example I use this code in the HTML table: <td><%=sessionvar1%><%=sessionvar2%></td>
3
295
by: Christopher Young | last post by:
I have several user controls on a page and I am trying to get information out of them. The postback is being caused on the aspx page and not in the user control. I have tried using a property but I keep getting a message that the object is not referenced. What I am trying to do is be information from text boxes and insert them into a new row in a dataset. The application has several tabs of information. I have a button set up so they...
0
1015
by: Bill Godsil | last post by:
I am trying to build a little Documentation search site, using WebMatrix, Access, and Index Server. I am placing my documentation in individual pages, as Index Server doesn't seem to want to index data that WILL be in the page, when built. It only wants to index what is in the static page. However, I want to access certian data about the document that I have stored in the Access database (even though it won't be indexed).
8
1346
by: Leszek Taratuta | last post by:
Hello, I have the following code: // Load the MenuBar.ascx user control. The control defines SavePropertyEvent event. UserControl ctrl = (UserControl)Page.LoadControl("~/MyApp/Controls/MenuBar.ascx"); // Get type information of the loaded user control.
4
1755
by: c676228 | last post by:
Hi everyone, I need to write a insruance program which needs to collect multiple people information, The information for each person includes name, email, address, phone, dob etc. The DOB data will be used for calculate premium for each person. and then display total premium quote to the user I had never done that before and not sure, in asp technology what is the easiest way to do. Let's say the user want to enroll 30 people but I...
3
3998
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user selects? thanks...
1
2277
by: Benny Ng | last post by:
Dear All, Now I met one problem in the development of my one application. I have one ASP.NET page. It's for disply the information of customer. But now I have one new requirement. It's to combine the "Edit" and "Display" funtions into this page. (It means if user want to edit the customer information, this page would provided editing page to the user; If the user want to display the customer information, this page would providev the...
1
1058
by: s14m27 | last post by:
Hi.... It might be a silly question but i'd like to know how to add external properies to the user control & also any information about user control too....... Thank you!!
2
7622
by: subramanian100in | last post by:
Is my following understanding correct ? Data abstraction means providing the interface - that is, the set of functions that can be called by the user of a class. Information hiding means mentioning the class members(functions, typedefs, data) under the access control labels : public, protected, private. Encapsulation means providing the implementation of class member
9
2584
klarae99
by: klarae99 | last post by:
I am new to this forum and still relatively new to Access (2003) and will try to explain my problem without alot of extra information to bog it down. I am trying to create an Inventory Database from scratch. Below is a list of the tables and fields relevent to this question. tblvendor fields for contact information (Name, Address, Etc.) VendorName VendorCode (a three letter code used in conjunction with the item # for reporting and...
0
7865
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
7990
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
8224
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
6637
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5731
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3849
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
2374
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
1
1461
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1198
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.