Last post Apr 17, 2018 08:08 AM by Brando ZWZ
Apr 16, 2018 02:10 AM|Ash93|LINK
Hi, currently i'm working on lucky draw system. User asked me to display the lucky draw result in a table on another page. Can asp.net run two page in one time? Can anyone help me on this. Thanks.
public partial class _Default : System.Web.UI.Page
string constr = ConfigurationManager.ConnectionStrings["lucky"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
static List<string> list = new List<string>();
protected void Button1_Click(object sender, EventArgs e)
string query = "SELECT TOP 1[Emp_id]FROM Emp_Info WHERE[Attendance] = 'Present'ORDER BY NEWID()";
using (SqlConnection con = new SqlConnection(constr))
using (SqlCommand cmd = new SqlCommand(query))
using (SqlDataAdapter sda = new SqlDataAdapter())
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
if (dt.Rows.Count > 0)
if (list.Any(x => x.Equals(dt.Rows["Emp_id"].ToString())))
//Label1.Text += "is duplicate";
Label1.Text = dt.Rows["Emp_id"].ToString();
Label1.Text += "Cannot draw! ";
Apr 17, 2018 08:08 AM|Brando ZWZ|LINK
According to your description, I couldn't understand your requirement clearly.
Do you mean you want to update one page and also show the result on another page?
If this is your requirement, I suggest you could consider using
ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of adding real-time web functionality to applications. Real-time web functionality is the ability to have server code push content to connected clients
instantly as it becomes available, rather than having the server wait for a client to request new data.
By using SignalR, you could broadcast the result to multiple page.