getting values from a user control?

Netnoobie

Regular
Joined
Feb 6, 2003
Messages
94
Location
Philadelphia
Hello all. This is my first attempt as utilizing a user control, and all was fine until now. On loading the page, I'm calling a UC that simplly creates formatted HTML. Getting into the UC code and creating the HTML is done. But how can I take the created HTML and display that in my UC? Page_Load is not a function, so how can I get the HTML to be output?

I'm calling: <tsd:TrackingSheetData runat="server"></tsd:TrackingSheetData> from my aspx. I don't see how to get the ascx output to bind to the control.

Many Thanks!
Bryan
 
Netnoobie said:
Getting into the UC code and creating the HTML is done. But how can I take the created HTML and display that in my UC?

What do you mean by that? If you've placed your html in the usercontrol, then just placing the control on the page and running the page will dispaly the html of the usercontrol
 
wessamzeidan said:
What do you mean by that? If you've placed your html in the usercontrol, then just placing the control on the page and running the page will dispaly the html of the usercontrol
That's what would think too...like the classic ASP include way. But it's not. The vb behind the control uses a global string and creates the HTML.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
strHTML = LoadData()
End Sub

and that sub:

Public Function LoadData() As String
Dim strTemp As String
strTemp = "<table border='0' cellpading='0' cellspacing='0' width='100%'>"
strTemp += GroupOutput()
strTemp += ContractOutput()
strTemp += SubGroups()
strTemp += "</table>"
Return strTemp
End Function


The other subs simply call various procs and create the HTML. But it's not dusplaying on the page, and the strHTML has a value. How can I bind the data to the UC?

and another question related to use controls: if a user control creates a text box on a page, how can I exract that text when a button is clicked? In both cases it seems like I'm missing a step in the user control creation and execution.

Thanks,
Bryan
 
Back
Top