|
 |
aspx_professional thread: Code behind declaration with user control
Message #1 by "Gary Milczarek" <gjm@s...> on Thu, 18 Apr 2002 07:46:34 -0600
|
|
You need to declare the User Control yourself, just like any other
variable, like this:
Protected WithEvents ctlConnectStrings1 As YourNameSpace.ctlConnectStrings
Visual Studio is supposed to do that for you when you switch from HTML to
design view, but due to a bug it doesn't.
Check out
http://support.microsoft.com/default.aspx?scid=3Dkb;EN-US;q316370&GSSNB=3D1
for
more info.
HtH
Imar
At 07:46 AM 4/18/2002 -0600, you wrote:
>I m trying to setup code behind for the sample code in Professional ASP
>Net multiple-dataset-sql.aspx.vb. The page uses a user control for the
>connection strings. When I bring the Page_Load code from the aspx page, I
>need to declare the reference to the user control.
>
>
>
>
>
>For example, how do I declare ctlConnectStrings below:
>
>
>
>
>
>Public Class multiple_dataset_sql
>
> Inherits System.Web.UI.Page
>
> Protected WithEvents dgrTables As System.Web.UI.WebControls.DataGrid
>
> Protected WithEvents dgrRelations As
System.Web.UI.WebControls.DataGrid
>
> Protected WithEvents dgrBooksData As
System.Web.UI.WebControls.DataGrid
>
> Protected WithEvents dgrAuthorsData As
System.Web.UI.WebControls.DataGrid
>
> Protected WithEvents dgrPricesData As
System.Web.UI.WebControls.DataGrid
>
> Protected WithEvents outConnect As
> System.Web.UI.HtmlControls.HtmlGenericControl
>
> Protected WithEvents outSelectBooks As
> System.Web.UI.HtmlControls.HtmlGenericControl
>
> Protected WithEvents outSelectAuthors As
> System.Web.UI.HtmlControls.HtmlGenericControl
>
> Protected WithEvents outSelectPrices As
> System.Web.UI.HtmlControls.HtmlGenericControl
>
> Protected WithEvents outError As
> System.Web.UI.HtmlControls.HtmlGenericControl
>
>
>
>#Region " Web Form Designer Generated Code "
>
>#End Region
>
>
>
> 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
>
>
>
> 'get connection string from ..\global\connect-strings.ascx user
> control
>
> Dim strConnect As String
>
> strConnect =3D
> ctlConnectStrings.SQLConnectionString <<<<<<<<<<<<<<<<<<<=DF
>
> outConnect.InnerText =3D strConnect 'and display it
>
>
>
>
>
>Thanks for any help,
>
>Gary
>
>
|
|
 |