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

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 3107
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.UserControl 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)
--

"Christopher Young" <cy****@midf.com> 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(OrderData.OrderHistory_TABL E).Rows(0)(OrderData.O
rderID_FIELD)) = "new" Then

_OrderID = order.CreateOrderID

Dim dr As DataRow =
_OrderData.Tables(OrderData.OrderHistory_TABLE).Ne wRow

dr(OrderData.OrderDate_FIELD) = CDate(Me.RecievedDate.Text)
dr(OrderData.OrderTypeID_FIELD) =
Me.dropOrderType.SelectedItem.Value
dr(OrderData.CurrencyID_FIELD) =
Me.dropCurrencyList.SelectedItem.Value
dr(OrderData.PurchOrderNumber_FIELD) =
Me.txtPurchaseOrderNum.Text
dr(OrderData.ReqDelDate_FIELD) = CDate(Me.ReqDelvDate.Text)
dr(OrderData.SpecialInstructions_FIELD) =
Me.txtSpecialInstructions

_OrderData.Tables(OrderData.OrderHistory_TABLE).Ro ws.Add(dr)
Else

End If

End Sub

Here is the code from the aspx page behind.

Imports SulfaTreat.Common.Data
Imports SulfaTreat.BusinessRules

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents GenInfo As
SulfaTreat.MySulfaTreat.OnlineOrders.GeneralInform ation

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

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

#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Session("OrderID") = "new"
GenInfo.SaveOrder()

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.SaveOrder 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)
--

"Christopher Young" <cy****@midf.com> wrote in message
news:OV**************@tk2msftngp13.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(OrderData.OrderHistory_TABL E).Rows(0)(OrderData.O
rderID_FIELD)) = "new" Then

_OrderID = order.CreateOrderID

Dim dr As DataRow =
_OrderData.Tables(OrderData.OrderHistory_TABLE).Ne wRow

dr(OrderData.OrderDate_FIELD) = CDate(Me.RecievedDate.Text)
dr(OrderData.OrderTypeID_FIELD) =
Me.dropOrderType.SelectedItem.Value
dr(OrderData.CurrencyID_FIELD) =
Me.dropCurrencyList.SelectedItem.Value
dr(OrderData.PurchOrderNumber_FIELD) =
Me.txtPurchaseOrderNum.Text
dr(OrderData.ReqDelDate_FIELD) = CDate(Me.ReqDelvDate.Text)
dr(OrderData.SpecialInstructions_FIELD) =
Me.txtSpecialInstructions

_OrderData.Tables(OrderData.OrderHistory_TABLE).Ro ws.Add(dr)
Else

End If

End Sub

Here is the code from the aspx page behind.

Imports SulfaTreat.Common.Data
Imports SulfaTreat.BusinessRules

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents GenInfo As
SulfaTreat.MySulfaTreat.OnlineOrders.GeneralInform ation

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

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

#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Session("OrderID") = "new"
GenInfo.SaveOrder()

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.NullReferenceException: Object reference not
set to an instance of an object.

Source Error:
Line 30:
Line 31: Session("OrderID") = "new"
Line 32: GenInfo.SaveOrder()
Line 33:
Line 34: End Sub
Source File: c:\inetpub\wwwroot\OnlineOrders\WebForm1.aspx.vb Line:
32

Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
SulfaTreat.MySulfaTreat.OnlineOrders.WebForm1.Butt on1_Click(Object
sender, EventArgs e) in
c:\inetpub\wwwroot\OnlineOrders\WebForm1.aspx.vb:3 2
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.Rai
sePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()


*** 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)
--

"Christopher Young" <cy****@midf.com> wrote in message
news:%2****************@TK2MSFTNGP10.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.NullReferenceException: Object reference not
set to an instance of an object.

Source Error:
Line 30:
Line 31: Session("OrderID") = "new"
Line 32: GenInfo.SaveOrder()
Line 33:
Line 34: End Sub
Source File: c:\inetpub\wwwroot\OnlineOrders\WebForm1.aspx.vb Line:
32

Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
SulfaTreat.MySulfaTreat.OnlineOrders.WebForm1.Butt on1_Click(Object
sender, EventArgs e) in
c:\inetpub\wwwroot\OnlineOrders\WebForm1.aspx.vb:3 2
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.Rai
sePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()


*** 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

GeneralInformation.ascx

<%@ Register TagPrefix="igsch"
Namespace="Infragistics.WebUI.WebSchedule"
Assembly="Infragistics.WebUI.WebDateChooser.v1" %>
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="GeneralInformation.ascx.vb"
Inherits="SulfaTreat.MySulfaTreat.OnlineOrders.Gen eralInformation"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ Register TagPrefix="date" Namespace="PeterBlum.DateTextBoxControls"
Assembly="DateTextBoxControls" %>
<asp:validationsummary id="svalGeneralInfo" Height="16px" Width="152px"
runat="server"></asp:validationsummary>
<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:dropdownlist id="dropOrderType"
Runat="server"></asp:dropdownlist></TD>
</TR>
<TR>
<TD noWrap>Date Received:</TD>
<TD><igsch:webdatechooser id="RecievedDate" Width="153"
runat="server">
<CalendarLayout PrevMonthImageUrl="ig_cal_grayP0.gif"
ShowTitle="False" NextMonthImageUrl="ig_cal_grayN0.gif">
<DayStyle BorderWidth="1px" BorderColor="#909090"
BorderStyle="Solid" BackgroundImage="ig_cal_light3.gif"></DayStyle>
<FooterStyle Height="16pt" Font-Size="8pt" ForeColor="#707070"
BackgroundImage="ig_cal_light2.gif"></FooterStyle>
<SelectedDayStyle ForeColor="Black"
BackgroundImage="ig_cal_light2.gif"></SelectedDayStyle>
<OtherMonthDayStyle ForeColor="#909090"></OtherMonthDayStyle>
<NextPrevStyle
BackgroundImage="ig_cal_light1.gif"></NextPrevStyle>
<CalendarStyle BorderWidth="1px" Font-Size="9pt"
Font-Names="Verdana" BorderColor="Gray" BorderStyle="Solid"
ForeColor="#505050" BackColor="#C0C0C0"></CalendarStyle>
<TodayDayStyle ForeColor="Black"
BackgroundImage="ig_cal_light1.gif"></TodayDayStyle>
<DayHeaderStyle Height="1pt" Font-Size="8pt" Font-Bold="True"
ForeColor="#606060" BackgroundImage="ig_cal_light2.gif"
BackColor="#C0C0C0"></DayHeaderStyle>
<TitleStyle Height="18pt" Font-Size="10pt" Font-Bold="True"
ForeColor="#606060" BackgroundImage="ig_cal_light1.gif"
BackColor="#E0E0E0"></TitleStyle>
</CalendarLayout>
<ExpandEffects ShadowColor="LightGray"></ExpandEffects>
</igsch:webdatechooser></TD>
</TR>
<TR>
<TD>Currency:</TD>
<TD><asp:dropdownlist id="dropCurrencyList" Width="88px"
runat="server"></asp:dropdownlist></TD>
</TR>
<TR>
<TD>Purchase Order #:</TD>
<TD><asp:textbox id="txtPurchaseOrderNum" Width="153px"
runat="server"></asp:textbox></TD>
</TR>
<TR>
<TD noWrap>Req. Delivery Date:</TD>
<TD><igsch:webdatechooser id="ReqDelvDate" Width="153"
runat="server" NullDateLabel=" ">
<CalendarLayout PrevMonthImageUrl="ig_cal_grayP0.gif"
ShowTitle="False" NextMonthImageUrl="ig_cal_grayN0.gif">
<DayStyle BorderWidth="1px" BorderColor="#909090"
BorderStyle="Solid" BackgroundImage="ig_cal_light3.gif"></DayStyle>
<FooterStyle Height="16pt" Font-Size="8pt" ForeColor="#707070"
BackgroundImage="ig_cal_light2.gif"></FooterStyle>
<SelectedDayStyle ForeColor="Black"
BackgroundImage="ig_cal_light2.gif"></SelectedDayStyle>
<OtherMonthDayStyle ForeColor="#909090"></OtherMonthDayStyle>
<NextPrevStyle
BackgroundImage="ig_cal_light1.gif"></NextPrevStyle>
<CalendarStyle BorderWidth="1px" Font-Size="9pt"
Font-Names="Verdana" BorderColor="Gray" BorderStyle="Solid"
ForeColor="#505050" BackColor="#C0C0C0"></CalendarStyle>
<TodayDayStyle ForeColor="Black"
BackgroundImage="ig_cal_light1.gif"></TodayDayStyle>
<DayHeaderStyle Height="1pt" Font-Size="8pt" Font-Bold="True"
ForeColor="#606060" BackgroundImage="ig_cal_light2.gif"
BackColor="#C0C0C0"></DayHeaderStyle>
<TitleStyle Height="18pt" Font-Size="10pt" Font-Bold="True"
ForeColor="#606060" BackgroundImage="ig_cal_light1.gif"
BackColor="#E0E0E0"></TitleStyle>
</CalendarLayout>
<ExpandEffects ShadowColor="LightGray"></ExpandEffects>
</igsch:webdatechooser></TD>
</TR>
</TABLE>
</TD>
<TD>
<TABLE>
<TR>
<TD>Special Instructions:</TD>
</TR>
<TR>
<TD><asp:textbox id="txtSpecialInstructions" Height="114px"
Width="280px" Runat="server" TextMode="MultiLine"></asp:textbox></TD>
</TR>
</TABLE>
</TD>
</TR>
</table>
<date:datetextboxvalidator id="dvalDateReceived" runat="server"
ErrorMessage="Please enter or select a valid date."
Display="None"
ControlToValidate="RecievedDate"></date:datetextboxvalidator><date:datet
extboxvalidator id="dvalReqDelivDate" runat="server"
ErrorMessage="Please enter or select a valid date."
Display="None"
ControlToValidate="ReqDelvDate"></date:datetextboxvalidator><asp:button
id="Submit" runat="server" Text="Button" Visible="False"></asp:button>

GeneralInformation.ascx.vb
Imports System.Diagnostics
Imports SulfaTreat.Common.Data
Imports SulfaTreat.BusinessRules

Public Class GeneralInformation
Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Public WithEvents txtSpecialInstructions As
System.Web.UI.WebControls.TextBox
Public WithEvents dropCurrencyList As
System.Web.UI.WebControls.DropDownList
Public WithEvents txtPurchaseOrderNum As
System.Web.UI.WebControls.TextBox
Protected WithEvents dvalReqDelivDate As
PeterBlum.DateTextBoxControls.DateTextBoxValidator
Protected WithEvents svalGeneralInfo As
System.Web.UI.WebControls.ValidationSummary
Public WithEvents dropOrderType As
System.Web.UI.WebControls.DropDownList
Protected WithEvents dvalDateReceived As
PeterBlum.DateTextBoxControls.DateTextBoxValidator
Public WithEvents ReqDelvDate As
Infragistics.WebUI.WebSchedule.WebDateChooser
Public WithEvents RecievedDate As
Infragistics.WebUI.WebSchedule.WebDateChooser
Public WithEvents Submit As System.Web.UI.WebControls.Button

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

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
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(Session("OrderID")) Then
Return CStr(Session("OrderID"))
Else
Return Nothing
End If
End Get
End Property

Public Property OrderTypeID() As Integer
Get
If dropOrderType.SelectedIndex <> -1 Then
Return CInt(dropOrderType.SelectedItem.Value)
Else
dropOrderType.SelectedIndex = 0
Return CInt(dropOrderType.SelectedItem.Value)
End If
End Get
Set(ByVal Value As Integer)
dropOrderType.SelectedIndex = Value
End Set
End Property

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

SulfaTreat.SystemSupport.ApplicationLog.WriteError ("Please select a
valid date.")
Else
Return CDate(Me.RecievedDate.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(dropCurrencyList.SelectedItem.Value)
End Get
Set(ByVal Value As Integer)
dropCurrencyList.SelectedIndex = Value
End Set
End Property

Public Property PurchaseOrderNum() As String
Get
Return txtPurchaseOrderNum.Text
End Get
Set(ByVal Value As String)
txtPurchaseOrderNum.Text = Value
End Set
End Property

Public Property ReqDevliveryDate() As Date
Get
If Me.dvalReqDelivDate.IsValid = False Then

SulfaTreat.SystemSupport.ApplicationLog.WriteError ("Please select a
valid date.")
Else
Return CDate(Me.ReqDelvDate.Text)
End If
End Get
Set(ByVal Value As Date)
Me.ReqDelvDate.Value = Value
End Set
End Property

Public Property SpecialInstructions() As String
Get
Return txtSpecialInstructions.Text
End Get
Set(ByVal Value As String)
txtSpecialInstructions.Text = Value
End Set
End Property

Private Property CurrencyList() As DataSet
Get
If Not IsNothing(HttpContext.Current.Cache("CurrencyList" ))
Then
Return CType(HttpContext.Current.Cache("CurrencyList"),
DataSet)
Else
Me.LoadCurrencyList()
Return _ds
End If
End Get
Set(ByVal Value As DataSet)
HttpContext.Current.Cache("CurrencyList") = Value
End Set
End Property

Private Property OrderTypeList() As DataSet
Get
If Not IsNothing(HttpContext.Current.Cache("OrderTypeList "))
Then
Return CType(HttpContext.Current.Cache("OrderTypeList"),
DataSet)
Else
LoadOrderTypeList()
Return _ds
End If
End Get
Set(ByVal Value As DataSet)
HttpContext.Current.Cache("OrderTypeList") = Value
End Set
End Property

#End Region

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

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

End Sub

Private Sub LoadDropLists()

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

With Me.dropOrderType
.DataSource =
Me.OrderTypeList.Tables(OrderData.OrderTypes_TABLE )
.DataTextField = OrderData.OrderTypeDescription_FIELD
.DataValueField = OrderData.OrderTypeID_FIELD
.DataBind()
End With

End Sub

Private Sub LoadCurrencyList()

Dim ord As New Orders

_ds = ord.GetCurrencyList()

HttpContext.Current.Cache("CurrencyList") = _ds

End Sub

Private Sub LoadOrderTypeList()

Dim ord As New Orders

_ds = ord.GetOrderTypes()

HttpContext.Current.Cache("OrderTypeList") = _ds

End Sub

Public Sub Clear()

Me.RecievedDate.Value = Date.Today
Me.dropCurrencyList.SelectedIndex = 0
Me.dropOrderType.SelectedIndex = 0
Me.ReqDelvDate.Value = ""
Me.txtPurchaseOrderNum.Text = ""
Me.txtSpecialInstructions.Text = ""

End Sub

Public Sub SaveOrder()

Dim order As New Orders
Dim _OrderData As New OrderData

If
CStr(_OrderData.Tables(OrderData.OrderHistory_TABL E).Rows(0)(OrderData.O
rderID_FIELD)) = "new" Then

_OrderID = order.CreateOrderID

Dim dr As DataRow =
_OrderData.Tables(OrderData.OrderHistory_TABLE).Ne wRow

dr(OrderData.OrderDate_FIELD) = CDate(Me.RecievedDate.Text)
dr(OrderData.OrderTypeID_FIELD) =
Me.dropOrderType.SelectedItem.Value
dr(OrderData.CurrencyID_FIELD) =
Me.dropCurrencyList.SelectedItem.Value
dr(OrderData.PurchOrderNumber_FIELD) =
Me.txtPurchaseOrderNum.Text
dr(OrderData.ReqDelDate_FIELD) = CDate(Me.ReqDelvDate.Text)
dr(OrderData.SpecialInstructions_FIELD) =
Me.txtSpecialInstructions

_OrderData.Tables(OrderData.OrderHistory_TABLE).Ro ws.Add(dr)
Else

End If

End Sub

Public Sub Submit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Submit.Click
SaveOrder()
End Sub
End Class

webform1.aspx

<%@ Register TagPrefix="uc1" TagName="GeneralInformation"
Src="Controls/GeneralInformation.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb"
Inherits="SulfaTreat.MySulfaTreat.OnlineOrders.Web Form1"%>
<%@ Register TagPrefix="uc1" TagName="CustomerInformation"
Src="Controls/CustomerInformation.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P>
<uc1:GeneralInformation id="GeneralInformation1"
runat="server"></uc1:GeneralInformation></P>
<P>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button></P>
</form>
</body>
</HTML>

webform1.aspx.vb

Imports SulfaTreat.Common.Data
Imports SulfaTreat.BusinessRules

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents GenInfo As
SulfaTreat.MySulfaTreat.OnlineOrders.GeneralInform ation

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

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

#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Session("OrderID") = "new"
System.Diagnostics.Debug.Write(GenInfo.ClientID)
GenInfo.SaveOrder()

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
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...
3
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...
0
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...
8
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 =...
4
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...
3
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...
1
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...
1
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
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...
9
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.