Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Call a function with a button?

Okay, having one more difficulty.
I have a function that posts information to a access db and I am using a confirm button to call the function. My problem is that I've tried to call the function many different ways and can't seem to get it right. I've heard everything from needing the "WithEvent" to having is post like a sub (where you just reference the button click in the sub). Can someone help me here? I can post the code if you need it. Thanks,

John
[485 byte] By [johnwooton] at [2007-11-11 8:14:05]
# 1 Re: Call a function with a button?
You will definitely need to post the code, also what tool are you using to develop this?
liRetro at 2007-11-11 23:13:26 >
# 2 Re: Call a function with a button?
Okay, first I am using an old tool to develop this, Web Matrix, using .net 1.1, but it's a lot more light weight than VWD.

Here's what I have:

First, and easiest, I have the button to confirm and fire the function:

<asp:Button id="Confbtn" onclick="ConfInsert" runat="server" Text="Verify Order"></asp:Button>

Then I have the function which stores the values of labels in the access db: (I'll only post the beginning few lines as the entire code can be tediously long)

Function ConfInsert( _
ByVal cardAmount As String, _
ByVal deliveryMethod As String, _
ByVal recipientName As String, _
ByVal recipientAddress As String, _
ByVal recipientCity As String, _
ByVal recipientState As String, _
ByVal recipientZip As String, _
ByVal recipientPhone As String, _
ByVal recipientEmail As String, _
ByVal senderName As String, _
ByVal billingName As String, _
ByVal billingAddress As String, _
ByVal billingCity As String, _
ByVal billingState As String, _
ByVal billingZip As String, _
ByVal billingPhone As String, _
ByVal billingEmail As String, _
ByVal Sender As System.Object, _
ByVal e As System.EventArgs)

Dim connectionString As String = ConfigurationSettings.AppSettings("ConnectionString")

Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)

My problem is that I need the button to call the function, but I need it to be secure (the page itself will have ssl, but I just don't want it throwing exceptions).

Can you help?

John
johnwooton at 2007-11-11 23:14:26 >
# 3 Re: Call a function with a button?
I still need help with this one if anybody can help.

John
johnwooton at 2007-11-11 23:15:20 >