Ragazzi, sto provando questo semplicissimo codice:
codice:using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace TestApp { public partial class PaginaProva : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { bool verificaInvio = Page.IsPostBack; // Verifica del valore della variabile verificaInvio if (verificaInvio == true) { Response.Write("C'è stato il postback"); } else { Response.Write("Nessun postback"); } } protected void Button1_Click(object sender, EventArgs e) { string nomeSpecificato = strNome.ToString(); lbl1.Text = nomeSpecificato; } } }codice:<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PaginaProva.aspx.cs" Inherits="TestApp.PaginaProva" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="strNome" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> Il tuo nome è: <asp:Label ID="lbl1" runat="server"></asp:Label> </div> </form> </body> </html>
Cliccando sul pulsante per il submit, la label non assume il valore di ciò che scrivo nella textbox, ma il valore: System.Web.UI.WebControls.TextBox.
Dove sbaglio??![]()

Rispondi quotando
