I have a repeater control and a SqlDataSource1 object on the aspx page.
In the code behind the page, I am calling a stored procedure. I would like to use the results of this stored procedure to populate the repeater control.
Is that possible?
The reason I would like to do this is because the stored procedure has parameters and I would like to pass in values for those parameters that are held as property values in a class (I use property Set and property Get for these values throughout these pages).
Alternatively, is it possible to still use the SqlDataSource1 object AND pass it the property values in the code?
Here is an example of my code:
Public Class SetVars
Public strIndicator As String
Public Property UserGreeting() As String
UserGreeting = strUser_Greeting
Set(ByVal value As String)
strUser_Greeting = value
firstpage.aspx.vb (this page Sets the value)
Dim sv as New SetVars
sv.strIndicator = "ALL"
secondpage.aspx.vb (this page has the SqlDataSource1 object but I'd rather call the stored proc and use the results from that..)
Protected Sub LoadData()
Dim conn As New SqlConnection
Dim cmd As New SqlCommand
Dim connstring As String
Dim sv As New SetVars
connstring = Connector.ConnectStringBuild
conn.ConnectionString = connstring
cmd.Connection = conn
cmd.CommandText = "ACT_GET_COLLECTION_DETAILS"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@INDICATOR", SqlDbType.VarChar).Value = sv.strIndicator
conn = Nothing
cmd = Nothing