E
evandelagrammaticas
Hi all. I have spent the better part of a day scouring the newsgroups
and I am sure that I must have come across the solution a number of
times - but I am still a real newbie at asp.net so please forgive me
beforehand if I ask anything really simple or ridiculous.
I am going to simplify my query... the structure of my example is
---> page1.aspx
------> page1.aspx.vb
--->control1.ascx
for the sake of simplicity this is what I am trying to achieve.
control1.ascx generates a value, say - number 1. I need display that
value in the onload event of page1.aspx.vb
The code is as follows:
I am showing the code for page1.aspx to show how I am declaring the
control on the site.
-------------- page1.aspx -------------------------------------
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="page1.aspx.vb"
Inherits="_Default" %>
<%@ Register Src="control1.ascx" TagName="control1" TagPrefix="uc1" %>
..
..
..
<uc1:control1 ID="control11" runat="server" /> 'including the user
control here
-------------- end of page1.aspx ------------------------------
I want to display the value generated in the user control here on
page1.aspx.vb
-------------- page1.aspx.vb -------------------------------------
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim selectedValue = Page.LoadControl("control1.ascx")
Response.Write(selectedValue.selectedProduct)
End Sub
End Class
-------------- end of page1.aspx.vb ------------------------------
The control generates a single number - in this case I am just saying 1
-------------- control.ascx-------------------------------------
<%@ Control Language="VB" ClassName="WebUserControl" %>
<script language="VB" runat="server">
Dim strSelectedProduct As String
Public Property selectedProduct() As String
Get
Return strSelectedProduct
End Get
Set(ByVal value As String)
strSelectedProduct = "1"
End Set
End Property
</script>
-------------- end of control.ascx-------------------------------------
Where am I going wrong? Any help would be really appreciated.
and I am sure that I must have come across the solution a number of
times - but I am still a real newbie at asp.net so please forgive me
beforehand if I ask anything really simple or ridiculous.
I am going to simplify my query... the structure of my example is
---> page1.aspx
------> page1.aspx.vb
--->control1.ascx
for the sake of simplicity this is what I am trying to achieve.
control1.ascx generates a value, say - number 1. I need display that
value in the onload event of page1.aspx.vb
The code is as follows:
I am showing the code for page1.aspx to show how I am declaring the
control on the site.
-------------- page1.aspx -------------------------------------
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="page1.aspx.vb"
Inherits="_Default" %>
<%@ Register Src="control1.ascx" TagName="control1" TagPrefix="uc1" %>
..
..
..
<uc1:control1 ID="control11" runat="server" /> 'including the user
control here
-------------- end of page1.aspx ------------------------------
I want to display the value generated in the user control here on
page1.aspx.vb
-------------- page1.aspx.vb -------------------------------------
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim selectedValue = Page.LoadControl("control1.ascx")
Response.Write(selectedValue.selectedProduct)
End Sub
End Class
-------------- end of page1.aspx.vb ------------------------------
The control generates a single number - in this case I am just saying 1
-------------- control.ascx-------------------------------------
<%@ Control Language="VB" ClassName="WebUserControl" %>
<script language="VB" runat="server">
Dim strSelectedProduct As String
Public Property selectedProduct() As String
Get
Return strSelectedProduct
End Get
Set(ByVal value As String)
strSelectedProduct = "1"
End Set
End Property
</script>
-------------- end of control.ascx-------------------------------------
Where am I going wrong? Any help would be really appreciated.