How are you
I use ASP.NET C # and
I'm having trouble that I have a text box and two buttons in the ASPX page (yes, no) and what do I want if the user clicks the Yes button then the label on the other ASPX page will be successful and when a user clicks
"C #" AutoEventWireup = "true" Co DeBehind = "3.aspx.cs" Inherits = "Lubna." "% & Gt; & gt; DOCTYPE html & gt; & gt; HTML xmlns =" http://www.w3.org/1999/xhtml "> gt; head runat =" server "& gt; & Lt; title & gt; & lt; / title & gt; & lt; / head & gt; & lt; body & gt; & lt; form id = "form1" runat = "server" & gt; & lt; Div> and 3.aspx.cs label.aspx and label.aspx.cs page
Enter ID
asp: text box id = "id_no" runat = "server"> << ASP: Button Id = "button2" runat = "server" onclic = "button 2_Click" text = "no" />
& Lt; / div & gt; & lt; / form & gt; & lt; / body & gt; & lt; / html Using the System.Collections.Generic; System.Linq using
system; ; Using System.Web; using System.Web.UI; Using System.Web.UI.WebControls; Namespace Lubna {Public Partial Class _3: System. Web. U.I. Page {secure zero page_load} (object sender, eventAgps E) {} Safe Void Button 1_Click (Object Sender, EventArggs E) {label label 1 = (Label) this.Master.FindControl ("LABEL1"); Label 1 Valid = true; Label1.Text = "successful"; Id_no.Text = ""; } Secure Zero Button 2_Click (Object Sender, Event AGS E) {Label Label 1 = (Label) this.Master.FindControl ("Label1"); Label 1 Valid = true; Label1.Text = "Failed"; Id_no.Text = ""; }}}
& lt ;! DOCTYPE html & gt; & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Head runat = "server" & gt; & Lt; Title & gt; & Lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form id = "form1" runat = "server" & gt; & Lt; Div & gt; & Lt; ASP: labeled id = "label 1" runat = "server" text = "label" & gt; & Lt; / Asp: label & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;
using the system; Using System.Collections.Generic; Using System.Linq; Using System.Web; Using System.Web.UI; Using System.Web.UI.WebControls; Namespace Lubna {Public partial class label: system. Web. UI pages (Safe senders, page items), object senders, event events e) {}}}
The page stretch can not directly modify one another, but you can redirect to some other event on the second page, and some in the URL (query string) Can pass the data. The received page will check the URL, and if it shows that data, then it can update its UI to show the data. System by using
3.aspx.cs
; Using System.Collections.Generic; Using System.Linq; Using System.Web; Using System.Web.UI; Using System.Web.UI.WebControls; Without namespace {public partial class _3: system. Web. Page {Safe object page_load (object sender, eventAgds E) {} Safe Void Button 1_Click (Object Sender, EventAurge E) {Response. Redirect ("label.aspx? Event = Successful"); } Secure Zero Button 2_Click (Object Sender, EventArgs e) {Response.Redirect ("label.aspx? Event = Failure"); }}}
label.aspx.cs
using the system; Using System.Collections.Generic; Using System.Linq; Using System.Web; Using System.Web.UI; Using System.Web.UI.WebControls; Namespace Lubna {Public partial class label: system. Web. UI Page {Secure Zero Page_load (Object Sender, Event Calendar E) {if (IsPostBack) {Label1.Text = Request.QueryString ["Event"] == Empty? "": Request .Querystring ["Event"]; }}}}
No comments:
Post a Comment