WEhalt
asked on
vb.net - Cursor form objects to set stored procedure parameter values
I would like to cursor through the items in my aspx form and automatically pass the parameter values instead of having to list each one individually.
Protected Sub SaveDailyClose()
...
Try
' Use a script that loops through each field on the form
' The object names on the form coincide with the parameter names
' create the call for the parameter
' move to the next object
...
Catch ex As Exception
Response.Write(ex.Message)
oDataAccess.CloseConnectio n()
Exit Sub
End Try
Protected Sub SaveDailyClose()
...
Try
' Use a script that loops through each field on the form
' The object names on the form coincide with the parameter names
' create the call for the parameter
' move to the next object
...
Catch ex As Exception
Response.Write(ex.Message)
oDataAccess.CloseConnectio
Exit Sub
End Try
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I don't know much javascript, but here are a few I found. You might also look into using something like jQuery. From what I have seen and read, might make this task easier...
http://stackoverflow.com/questions/187059/how-to-get-all-the-controls-in-page-using-javascript-in-asp-net-page
http://www.eggheadcafe.com/community/javascript/3/10016212/loop-through-the-controls-in-the-form.aspx
http://stackoverflow.com/questions/187059/how-to-get-all-the-controls-in-page-using-javascript-in-asp-net-page
http://www.eggheadcafe.com/community/javascript/3/10016212/loop-through-the-controls-in-the-form.aspx
ASKER
in vb
Dim ctrl As Control
For Each ctrl In Me.Controls
Next
Dim ctrl As Control
For Each ctrl In Me.Controls
Next
ASKER
Do you have a source for that?