Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have created a custom control that returns an SqlConnection object. This is in a .ASCX file.

 

Can I reference this control from inside a .VB code-behind file? Currently, I am referencing it in the .ASPX file via:

<%@ Register TagPrefix="MyTag" TagName="Ctrl" Src="controls\Connection.ascx" %>

<head>
   <MyTag:Ctrl id="MyConn" runat="Server"></MyTag:Ctrl>
</head>

Posted
It is a connection object being returned from the custom control. I am still trying to wrap my head around ASP.NET's structure, so I am probably doing something so-very-wrong and missing the obvious. My goal is simply to maintain the connection string to the back-end database in one place. I found info on the Net about using this kind of custom control. That was before I used code-behind. I am now guessing the two don't go together? Should I just make a class that returns a connection object instead? Should I do something else?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...