T
thersitz
Hi,
I visited this page to look at the postback tutorial:
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/tipstricks/default.aspx
I take the code from this page for the postback tutorial and stick it into
new pages in my local website and they work. But when I try to implement the
code in some existing files -- it fails. The difference bewtween the files I
downloaded and the existing files in which I am trying to use the code
include:
1) my file uses a masterpage, a codebehind file, and an imageButton (as
opposed to a regular button)
2) my file is a form that writes to a database, uploads an image to a
directory, and then takes the user to a confirmation page where I am trying
to display the results of the form.
When i submit my form, the data is written to the db, the image is
uploaded -- but on the confirmation page, the label appears, but it does not
contain the text entered in the txtLastName text box on the form -- rather
it contains the default text in the label (Text="Label").
Here's the relevant code
confirmation page:
==============================
<asp:Label ID="LabelX" runat="server" Text="Label" Font-Size="16pt"
ForeColor="#FF0066" Font-Italic="True" /><span style="font-size: 16pt">
</span>
code behind
==============================
Partial Class forms_artsFestivalUpload
Inherits System.Web.UI.Page
Protected WithEvents LabelX As System.Web.UI.WebControls.Label
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim txtLastName As TextBox
txtLastName = Page.PreviousPage.FindControl("txtLastName")
LabelX.Text = txtLastName.Text
End Sub
End Class
imagebutton on web form:
==============================
<asp:ImageButton ID="imageButton1" runat="server"
ImageUrl="submit-button.jpg" Width="100px"
PostBackUrl="artsfestivalupload.aspx" />
Can anyone tell me where I am goofed up?
thanks
I visited this page to look at the postback tutorial:
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/tipstricks/default.aspx
I take the code from this page for the postback tutorial and stick it into
new pages in my local website and they work. But when I try to implement the
code in some existing files -- it fails. The difference bewtween the files I
downloaded and the existing files in which I am trying to use the code
include:
1) my file uses a masterpage, a codebehind file, and an imageButton (as
opposed to a regular button)
2) my file is a form that writes to a database, uploads an image to a
directory, and then takes the user to a confirmation page where I am trying
to display the results of the form.
When i submit my form, the data is written to the db, the image is
uploaded -- but on the confirmation page, the label appears, but it does not
contain the text entered in the txtLastName text box on the form -- rather
it contains the default text in the label (Text="Label").
Here's the relevant code
confirmation page:
==============================
<asp:Label ID="LabelX" runat="server" Text="Label" Font-Size="16pt"
ForeColor="#FF0066" Font-Italic="True" /><span style="font-size: 16pt">
</span>
code behind
==============================
Partial Class forms_artsFestivalUpload
Inherits System.Web.UI.Page
Protected WithEvents LabelX As System.Web.UI.WebControls.Label
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim txtLastName As TextBox
txtLastName = Page.PreviousPage.FindControl("txtLastName")
LabelX.Text = txtLastName.Text
End Sub
End Class
imagebutton on web form:
==============================
<asp:ImageButton ID="imageButton1" runat="server"
ImageUrl="submit-button.jpg" Width="100px"
PostBackUrl="artsfestivalupload.aspx" />
Can anyone tell me where I am goofed up?
thanks