pass the right form input to the right control

T

Tom

Hi,

I have this question below but still cannot fix it.

http://communities.microsoft.com/newsgroups/previewFrame.as
p?
ICP=msdn&sLCID=us&sgroupURL=microsoft.public.dotnet.framewo
rk.aspnet&sMessageID=%253C01e601c3bef5%25240e272fe0%
(e-mail address removed)%253E


Here are my code:

A register.aspx includes 2 user controls.

register.aspx

<%@ Page language="c#" Codebehind="register.aspx.cs"
AutoEventWireup="false" Inherits="web.register" %>
<%@ Register TagPrefix="web" TagName="top" Src="_top.ascx"
%>
<%@ Register TagPrefix="web" TagName="left"
Src="_left.ascx" %>
<%@ Register TagPrefix="web" TagName="bottom"
Src="_bottom.ascx" %>
<%@ Register TagPrefix="web" TagName="register"
Src="_register.ascx" %>

<form runat="server" method="post" ID="Form13">
<web:top ID="top1" runat="server" />
<table align="center" width="780" border="0"
cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="140">
<web:left ID="left1" runat="server" />
</td>
<td width="640">
<web:register ID="register1" runat="server" />
</td>
</tr>
<web:bottom ID="bottom1" runat="server" />
</form>

You can see that I put the form tag on a single aspx page
which includes several user controls and each of them has
a form to submit.

_left.ascx

<table width="100%" border="1" bordercolor="#9999e7"
cellspacing="0" cellpadding="2">
<tr bgcolor="#9999e7" align="middle">
<td>user register</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tbody>
<tr>
<td width="5">&nbsp;</td>
<td nowrap>user name:</td>
<td>

<asp:TextBox id="username" runat="server"
CssClass="form" Width="70px"></asp:TextBox>

<asp:RequiredFieldValidator id="RequiredUserName"
runat="server" ErrorMessage="pls enter user name!"
Display="None" EnableViewState="False"
ControlToValidate="username"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="5">&nbsp;</td>

<td>Password:</td>
<td>

<asp:TextBox id="PassWord" runat="server"
Width="70px" CssClass="form"
TextMode="Password"></asp:TextBox>

<asp:RequiredFieldValidator id="RequiredPassword"
runat="server" ErrorMessage="Pls enter password!"
Display="None" EnableViewState="False"
ControlToValidate="PassWord"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="5">&nbsp;</td>

<td><asp:button id="ibtnLogin" runat="server"
text="Submit"></asp:button>&nbsp;</td>
<td><a href="lostpassword.aspx" target="_blank">Lost
password</a></td>
</tr>
<tr>
<td width="5">&nbsp;</td>
<td colspan="2"><asp:ValidationSummary
id="ValidationSummary"
runat="server" ShowSummary="False" ShowMessageBox="True"
EnableViewState="False"></asp:ValidationSummary>

<asp:Label id="labErrorMSG" runat="server"
CssClass="node"></asp:Label>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>


_register.ascx

It also has a register form.

Here is the _register.ascx.cs

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the
page here
if(!IsPostBack)
{
this.Bind_New();
}
}

Here is the _left.ascx.cs

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the
page here
}

I am not sure how to write code for these 2 Page_Load and
PostBack.

Thanks for any kind help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,737
Latest member
Georgeengab

Latest Threads

Top