What is the best way to make a subroutine visible to multiple .aspx documents and return multiple values

I have a complex subroutine that has 10 input values and needs to return 10 result values.  What is the best way to make this visible to multiple .aspx documents?

 

Thanks,

David 

0
davidgreenbe
1/19/2007 8:33:51 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

2 Replies
552 Views

Similar Articles

[PageSpeed] 37
Get it on Google Play
Get it on Apple App Store

you can try with custom entity objects as return type.

Entity class has a property of all results. 

 

0
Malar_apk
1/19/2007 10:44:33 PM

This depends on your architecture.  If this is just a common subroutine that is not related to a class, you could just create a class of utility methods.  (I still say class because I'm anti-module in VB).  If you declare the subroutine as public/friend with a static (C#) or Shared (VB) modifier, you can access the subroutine without making an instance of a class.  The best way to pass multiple parameters when a class is unnecessary is to use a structure.

Public Class Utility
  Public Shared Sub GetValues(ByRef ValueStruct As MyStructure)
    ValueStruct.Value1 = "New Value"
    ValueStruct.Number2 = 5
  End Sub
End Class


Public Structure MyStructure
  Public Value1 As String
  Public Value2 As String
  Public Number1 As Integer
  Public Number2 As Integer
End Structure

 

If you're familiar with classes, you can also do similar things with structures such as give them Properties or their own methods.  Properties are good in cases where you assign a control to be databound to a specific control, because databinding requires properties.


---------------------------------------
MCP - Web Based Client Development .NET 2.0
0
ps2goat
1/19/2007 10:50:00 PM
Reply:

Similar Artilces:

problem getting multiple values returned from a subroutine
I'm having problem getting multiple values returned from a subroutine. Thanks in advance for pointers. My codes: #!/usr/bin/perl use strict; use warnings; ############################################################################ # Get required subroutines which need to be included. # ############################################################################ require "/home/sybase/scripts/pl/prod/global_dcapdsg001.pl"; require "/home/sybase/scripts/pl/prod/dataStage_dcapdsg001.pl"; my $po_file = '/ftpsite/as400/ms4/SH135.prt&...

return multiple values from subroutine
i want to return multiple values from a subroutine. all the examples i have seen show just a single value (sometimes an array) being returned, and until now i have been creating an array just for this purpose. what i would like to do is what i have done in the simple code below (that obviously doesn't work). i have a couple of questions : 1. can "return" be used to return multiple values or do they all have to be collected into one structure like an array? 2. is there any way i can do a multiple assignment like i tried to do in the last line below? i a...

Multiple values for multiple items insert using c#.net
Hello, I have an application that allows the user to insert multiple values all related to the same item that reside in multiple tables. example base information, style general details, parts of a style etc. a single table binds them all together using foreignkeyid's. This is kind of a slow process, because they might have to create a set of styles in different colors etc on the same day. say 15 items which are different only in color. Now, I' m having to design a form which will let them insert all 15 items at once.  I dont know how to show you the lay out I have?? My idea abo...

more efficient way to get multiple values from the same table
Morning Y'all: I've got this table called def and value..def is the definition table that holds the definitions of different pieces of data (date, string, etc). It holds how data is displayed. The value table stores the actual values based on defs record defiinitions.. Example: def has a record with an id called "DEV START" which is a date a record with an id called "PRINT RECVD" which is a date value has a record for the first definition with a va lue of 03-Mar-02 value has a record for the second definition with a valu...

SQL,Make Multiple values for multiple columns into one column separated by comma
Hi, I'm getting the result as this Name       Class       Subject------------------------------------------Anju         10             MathsAnju         10             Physics How to write the query to get the result like this Name       Class       Subjects------------...

What is the best way to handle multiple processes on one aspx page?
Hello, I have a webform1.aspx page that takes in user selections from a DataGrid. When the user clicks the submit button I issue a Server.Transfer to a second aspx page (Processing.aspx). I do this becuase I want the page to show a Message to the user that a process is running. I will do some network access stuff in this processing page which could take up to 30 sec or less. If any of the processes fail, I hope to transfer back to the first page with an error message but if the processes are successful then I want to post to a success page. Does anyone know the best way to ha...

ICallbackEventHandler and passing multiple string values to server and receiving multiple values
Hello, I need some help with ICallbackEventHandler and was wondering if some experts can share their knowledge on this. Thanks in advance. I am retrieving results from a web service that returns xml nodes. In order to return XML nodes to client, I have converted xmlnodes into string (string concatenation and returned one string to the client). Is there a way to return may be xml or JSON or even a string array using ICallbackEventHandler. Here is my complete code. Imports net.ecubicle.www Imports System.Xml.LinqPartial Class driving_web_service Inherits System.Web.UI.PageImplements ICa...

Best way to pass multiple records into Oracle Stored Procedure in one call from .NET
Hi, I have been looking to find optimal way to pass record set (which is collection of records to be inserted into an oracle table which containts about 100+ columns) as parameter to Oracle stored procedure. This way, I would not need to create parameter for each column and call the Stored Proc too many times. I am thinking to make use of some kind of data structure which can be interpretted in both Oracle and .NET sides,something similar to Table of Oracle Object type or Oracle Record(of type <Table>%RowType) . I did not find support for neither of ...

returning multiple values
Thanks for all your help earlier. I am doing much better now. 1/3 of my script actually passes the tests now! But I seem to be stuck again. This sub is supposed to take a string and parse it into another string and 2 integers. I get the new string back but not the integers, any ideas? It passes the first test: print "not " unless defined &parse_range; print "ok 2\n"; On the second test for this sub I get: Failed 1/1 test scripts, 0.00% okay. 1/5 subtests failed, 80.00% okay. *** Error code 29 Belinda <snip excess code> void parse_range (...

Returning multiple values
Hi! I use "Return var" to return a single value from my web service. So I need to know how to return multiple values instead of a single one. Can you help me? Thanks a lot. Please see below example, it could lead to solve your problem! http://www.w3coder.com/contest/examples/WSObjMultiArr.asmx source code at http://www.w3coder.com/contest/examples/WSObjMultiArr.asmx.txt Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti...

Multiple Return Values
I have a situation where I need two values (both are integers) returned from a stored procedure. (SQL 2000) Right now, I use the statement "return @@Identity" for a single value, but there is another variable assigned in the procedure, @NewCounselingRecordID that I need to pass back to the calling class method. I was thinking of concatenating the two values as a string and parsing them out after they are passed back to the calling method. It would look something like "21:17", with the colon character acting as a delimiter. However, I feel this solution is kludg...

how to upload multiple files at once like the sharepoints "upload multiple documents" which has check boxes to select multiple files for uploading
[ASP.NET2.0,C#] how to upload multiple files at once like the sharepoints "upload multiple documents" which displays exporer kind of view and  which has check boxes to select multiple files for upload at once.  Hi SharePoint uses an OCX control similar to this one: http://www.componentsource.com/products/dextuploadx/index.html I created some kind of sharepoint for some purposes, where also was included the logic of documents workflows. So I had also a page where I was uploading multiple files(one by one), but in reallity the upload of all the files was done when I wa...

Multiple code-behind for multiple aspx pages?
I assume it's possible to have not just one code-behind.  For example, in my project, I have: index.aspx with index.aspx.vb error.aspx I need to create a code-behind for error.aspx so I can establish a page_load for it.  Is there an easy/quick way to add and link a new code-behind .vb page for error.aspx if it doesn't already have one through VS 2005 without having to go through the manual process of creating a new class, then changing the error.aspx page directives to correctly point to the new code-behind?  I thought there was a way VS 2005 could do this somehow in an opt...

SqlDataReader
Hello all,I'm trying to request a number of URLS (one for each user) from my database, then place each of these results into a separate string variables. I believed that SqlDataReader could do this for me, but I am unsure of how to accomplish this, or if I am walking down the wrong road. The current code is below (the section in question is in bold), please ignore the fact that I'm using MySQL as the commands work in the same way. public partial class main : System.Web.UI.Page{    String UserName;    String userId;    String HiveConnectionStr...

Web resources about - What is the best way to make a subroutine visible to multiple .aspx documents and return multiple values - asp.net.getting-started

Subroutine - Wikipedia, the free encyclopedia
In computer programming , a subroutine is a sequence of program instructions that perform a specific task, packaged as a unit. This unit can ...

Subroutine - Wikipedia, the free encyclopedia
In computer programming , a subroutine is a sequence of program instructions that perform a specific task, packaged as a unit. This unit can ...

Apple-Samsung jury discovers joys of subroutines, class libraries
... jury hearing Apple's patent infringement case against Samsung was thrown into the deep end Monday and subjected to some heady talk of subroutines ...

Mitt Romney humor subroutine activated: 'If I were to coin a term, it would be Obamalogna'
Oh, Mitt. I'm afraid his rejoinder to Barack Obama's "Romney Hood" line is just ... well ... "If I were to coin a term, it would Obamalogna. ...

Bad AppleScript: Subroutines and file paths
... have line numbers–I think it was Pascal—I couldn’t comprehend it. Well, we’ve come a long way. I can’t type GOSUB 5000 anymore, but subroutines ...

Apple-Samsung jury discovers joys of subroutines, class libraries
... jury hearing Apple's patent infringement case against Samsung was thrown into the deep end Monday and subjected to some heady talk of subroutines ...

Apple-Samsung jury discovers joys of subroutines, class libraries
... jury hearing Apple’s patent infringement case against Samsung was thrown into the deep end Monday and subjected to some heady talk of subroutines ...

Subroutine - Wikipedia, the free encyclopedia
In computer programming , a subroutine is a sequence of program instructions that perform a specific task, packaged as a unit. This unit can ...

Subroutine - Wikipedia, the free encyclopedia
In computer science , a subroutine , also termed procedure , function , routine , method , or subprogram , is a part of source code within a ...

Subroutine - Wikipedia, the free encyclopedia
In computer science , a subroutine , also termed procedure , function , routine , method , or subprogram , is a part of source code within a ...

Resources last updated: 12/28/2015 12:10:00 AM