Here's the "Loader" for the Support ticket user control.
The DirectCast call was an effort to try to force the page to realize the type of the control being loaded and thus handle its events; it didn't work...
<%@ Reference Control="contactUsPage.ascx" %>
<script language="
vb" runat="Server">
Protected Sub btnContactUs_Click (s As Object, e As EventArgs)
Dim ctrl As Control
ctrl = LoadControl ("contactUsPage.ascx")
ctrl = DirectCast (ctrl, contactUsPage)
plhMain.Controls.Clear ()
plhMain.Controls.Add (ctrl)
End Sub
</script>
And the control itself (note I've removed any database stuff to try to simplify):
<%@ Control ClassName="contactUsPage" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>
<script Language="
VB" Runat="Server">
Protected Sub btnSendQuestion_Click (s As Object, e As EventArgs)
Response.redirect ("thankyou.aspx")
End Sub
</script>
<table align=center border=0 width=100%>
<tr><td>
<table cellpadding=3>
<tr><td valign=top><img src="images/wine_web_logo.gif">
<td> <img src="images/title_contactus.gif">
</tr>
</table>
</tr>
<tr><td>
<table width=100%>
<tr><td align=center colspan=2>Please fill out the following form</tr>
<tr><td align=right>Email Address: <td><asp:TextBox id="txtEmail" Size="40" MaxLength="100" Runat="Server" />
<asp:RequiredFieldValidator ControlToValidate="txtEmail" Display="Dynamic" Text="Required" Runat="Server" />
</tr>
<tr><td align=right>Question/Comment: <td><asp:TextBox id="txtQuestion" Rows="8" Columns="40" TextMode="MultiLine" Runat="Server" />
<asp:RequiredFieldValidator ControlToValidate="txtQuestion" Display="Dynamic" Text="Required" Runat="Server" />
</tr>
<tr><td colspan=2 align=center><asp:Button id="btnSendQuestion" class="btn" OnClick="btnSendQuestion_Click" Text="Send" Runat="Server" /></tr>
</table>
</tr>
</table>
<br><br>