B
BigOldH
Hi
I have been working through some basic samples and there is a problem with a
call to a button click
I am using Visual Studio 2008 and have placed a text box, a label and button
on a page - sample code here
<script language="C#" runat="server">
private void Button1_Click(object sender, System.EventArgs e)
{
lblSample.Text = txtSample.Text;
}
</script>
<form id="Form1" method="post" runat="server">
<P> <asp:Label id="lblSample" runat="server"
Width="208px">Label</asp:Label></P>
<P> <asp:Label id="Label1" runat="server" Width="104px">Enter Text
Here:</asp:Label>
<asp:TextBox id="txtSample" runat="server"></asp:TextBox></P>
<P> <asp:Button id="Button1" runat="server" Text="Submit"></asp:Button> </P>
</form>
this submits the form but does not update the label.Text.
setting a break point in the button click never gets called
If however I transfer the code to the Page Load event it does get called.
Given that this is asample of a similar type in both a book and from a
seperate online tutorial it seems that I am doing something basically wrong.
TIA
H
I have been working through some basic samples and there is a problem with a
call to a button click
I am using Visual Studio 2008 and have placed a text box, a label and button
on a page - sample code here
<script language="C#" runat="server">
private void Button1_Click(object sender, System.EventArgs e)
{
lblSample.Text = txtSample.Text;
}
</script>
<form id="Form1" method="post" runat="server">
<P> <asp:Label id="lblSample" runat="server"
Width="208px">Label</asp:Label></P>
<P> <asp:Label id="Label1" runat="server" Width="104px">Enter Text
Here:</asp:Label>
<asp:TextBox id="txtSample" runat="server"></asp:TextBox></P>
<P> <asp:Button id="Button1" runat="server" Text="Submit"></asp:Button> </P>
</form>
this submits the form but does not update the label.Text.
setting a break point in the button click never gets called
If however I transfer the code to the Page Load event it does get called.
Given that this is asample of a similar type in both a book and from a
seperate online tutorial it seems that I am doing something basically wrong.
TIA
H