Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7852363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:24:02+00:00 2026-06-02T19:24:02+00:00

I am currently developing a solution that uses YUI grids. My problem is that

  • 0

I am currently developing a solution that uses YUI grids. My problem is that my home page is a summary of all my other pages, it includes a summary grid of the grids displayed on other pages, and I dont want to reuse the same code in each page’s code behind. Im trying to centralize it. So what I have done is I have made <asp:Placeholders id="LoadOpenPurchasesGridDataPlaceholder" runat="server"> where I write a JSON string into, on the home page and the Open Purchases Page. However, because I want to share the sub procedure across all pages, I have made it public shared, but it gives an error: cannot refer to an instance member of a class from within a shared method or shared member.

Now if I want to response.write to a page from a different code begind I use HttpContext.Current.Response.Write(). Is there a similar way of accessing the page’s HTML controls from where I am calling it. (I have tried to explain it in detail, sorry for confusion caused.)

My Code:

Shared Sub LoadOpenPurchasesGrid(ByVal Location As String, ByVal Coop As String, ByVal Commodity As String, ByVal Financed As String, ByVal Season As String, ByVal Trader As String, ByVal Department As String, ByVal Database As String)
Try
Dim ReturnString As String = Nothing
If Location = “0” And Coop = “0” And Commodity = “0” And Season = “0” And Trader = “0” Then
ReturnString = (LoadOpenPurchasesGridData(“”, “”, “”, “”, “”, Department, Database))
Dim LoadGridDataContainer As New HtmlGenericControl(“input”)
LoadGridDataContainer.ID = “hdnOpenPurchasesGridData”
LoadGridDataContainer.Attributes.Add(“type”, “hidden”)
LoadGridDataContainer.Attributes.Add(“value”, ReturnString)
LoadOpenPurchasesGridDataPlaceholder.Controls.Add(LoadGridDataContainer)
Else
ReturnString = (LoadOpenPurchasesGridData(Location, Coop, Commodity, Season, Trader, Department, Database))
HttpContext.Current.Response.Write(ReturnString)
End If
HttpContext.Current.Response.Write(ex.message)
End Try
End Sub

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:24:03+00:00Added an answer on June 2, 2026 at 7:24 pm

    I have found the answer to my question. Instead of trying to reference the placeholder directly from the calling method, I rather pass the placeholder as a method parameter, and I send it from the calling method as Me.PlaceholderID.

    ' Public Shared Sub LoadOpenPurchasesGridData(ByRef Placeholder As Object, ByVal Location As String, ByVal Coop As String, ByVal Commodity As String, ByVal Season As String, ByVal Trader As String, ByVal SearchCriteria As String, ByVal Department As String, ByVal Database As String, ByVal InitialLoad As Boolean)
            Dim SqlConnection As New SqlConnection
            Dim SqlCommand As New SqlCommand
            Dim SqlParameter As New List(Of SqlParameter)
            Dim SqlReader As SqlDataReader = Nothing
            Dim ReturnString = "["
            Dim Counter As Integer = 1
            Try
                SqlConnection = CreateDatabaseConnection(ConnectionString)
                AddSqlParameterToCollection(SqlParameter, "@Location", Location)
                AddSqlParameterToCollection(SqlParameter, "@Coop", Coop)
                AddSqlParameterToCollection(SqlParameter, "@Commodity", Commodity)
                AddSqlParameterToCollection(SqlParameter, "@Season", Season)
                AddSqlParameterToCollection(SqlParameter, "@Trader", Trader)
                AddSqlParameterToCollection(SqlParameter, "@Search", SearchCriteria)
                AddSqlParameterToCollection(SqlParameter, "@Database", Database)
                SqlCommand = CreateSqlCommand("[proc_Dynamic_GetPOC]", SqlConnection, SqlParameter)
                SqlReader = SqlCommand.ExecuteReader()
                If SqlReader.HasRows Then
                    Do While SqlReader.Read And Counter < 200
                        If Counter <> 1 Then
                            ReturnString += ","
                        End If
                        ReturnString += "{""PrimCont"":""" & SqlReader("PrimCont") & ""","
                        ReturnString += """PSCM_COOP_ID"":""" & SqlReader("PSCM_COOP_ID") & ""","
                        ReturnString += """POCNumber"":""" & SqlReader("POCNumber") & ""","
                        ReturnString += """VENDORID"":""" & SqlReader("VENDORID") & ""","
                        ReturnString += """VendorContract"":""" & SqlReader("VendorContract") & ""","
                        ReturnString += """ITMCLSDC"":""" & SqlReader("ITMCLSDC") & ""","
                        ReturnString += """CommodityGrade"":""" & SqlReader("CommodityGrade") & ""","
                        ReturnString += """ContractQty"":""" & SqlReader("ContractQty") & ""","
                        ReturnString += """LIQty"":""" & SqlReader("LIQty") & ""","
                        ReturnString += """TonsNotFinalized"":""" & SqlReader("TonsNotFinalized") & ""","
                        ReturnString += """POC_DEL_QTY"":""" & SqlReader("POC_DEL_QTY") & ""","
                        ReturnString += """OpenQty"":""" & SqlReader("OpenQty") & ""","
                        ReturnString += """ContractPrice"":""" & SqlReader("ContractPrice") & ""","
                        ReturnString += """PurchaseBasis"":""" & SqlReader("PurchaseBasis") & ""","
                        ReturnString += """Safex Month"":""" & SqlReader("Safex Month") & ""","
                        ReturnString += """SpreadToSafexMonth"":""" & SqlReader("SpreadToSafexMonth") & ""","
                        ReturnString += """LOCNDSCR"":""" & SqlReader("LOCNDSCR") & ""","
                        ReturnString += """Area"":""" & SqlReader("Area") & ""","
                        ReturnString += """VesselName"":""" & SqlReader("VesselName") & ""","
                        ReturnString += """DeliveryMonth"":""" & SqlReader("DeliveryMonth") & ""","
                        ReturnString += """SignedContract"":""" & SqlReader("SignedContract") & """}"
                        Counter += 1
                    Loop
                End If
                ReturnString += "]"
                Counter = 0
                If InitialLoad = True Then
                    Dim LoadGridDataContainer As New HtmlGenericControl("input")
                    LoadGridDataContainer.ID = "hdnOpenPurchasesGridData"
                    LoadGridDataContainer.Attributes.Add("type", "hidden")
                    LoadGridDataContainer.Attributes.Add("value", ReturnString)
                    Placeholder.Controls.Add(LoadGridDataContainer)
                Else
                    HttpContext.Current.Response.Write(ReturnString)
                End If
            Catch ex As Exception
                HttpContext.Current.Response.Write("<span class=""error_message_span"">ERROR - An error occurred loading the open puchases grid. Please contact the system administrators for assistance.</span>" & ex.Message)
            Finally
                If Not IsNothing(SqlReader) Then
                    SqlReader.Close()
                    SqlReader = Nothing
                End If
                If Not IsNothing(SqlCommand) Then
                    SqlCommand.Dispose()
                    SqlCommand = Nothing
                End If
                If Not IsNothing(SqlConnection) Then
                    SqlConnection.Close()
                    SqlConnection.Dispose()
                    SqlConnection = Nothing
                End If
            End Try
        End Sub'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a lightweight e-commerce solution that uses PayPal as the payment gateway. However,
I am currently developing a system that holds all relevant master data like for
Currently I'm using Visual Studio 2008 (SP1) and developing some code that uses nested
I have a prospective client that currently uses Miva Merchant as their e-commerce solution.
Situation We are currently developing a Sharepoint 2010 site that uses Infopath 2010 forms.
I am currently developing an application that uses databases dynamically. meaning it is designed
I'm currently developing a solution and have designed it in a way such that
In the web-application I'm developing I currently use a naive solution when connecting to
Currently developing a PHP framework and have ran into my first problem. I need
I'm currently developing an iOS app that interacts with a server (in django) via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.