Generate Random Numbers
Generate Random Numbers in Add the Minimum & Maximum Range Control to Refresh Ajax Timer & Script Manager in Asp.Net C#.
Download Coding
Download
DEMO
Generate Random Numbers in Add the Minimum & Maximum Range Control to Refresh Ajax Timer & Script Manager in Asp.Net C#.
Download Coding
Download
DEMO
SYNTAX
random.Next(int Minimum ,int Maximum)
Html Coding
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<asp:Label ID="lblRandom1" runat="server" ForeColor="#CC3300"></asp:Label>
<br />
<asp:Label ID="lblRandom2" runat="server" ForeColor="#CC66FF"></asp:Label>
<br />
<asp:Label ID="lblRandom3" runat="server" ForeColor="#CC3300"></asp:Label>
<br />
<asp:Label ID="lblRandom4" runat="server" ForeColor="#CC66FF"></asp:Label>
<br />
<asp:Label ID="lblRandom5" runat="server" ForeColor="#CC3300"></asp:Label>
<br />
<br />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />
<asp:Timer ID="Timer1" runat="server" Interval="3000">
</asp:Timer>
<br />
</div>
</form>
</body>
</html>
C# Coding
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Randoms : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// rm.Next(Minimum Number,Maximun Number)
Random rm = new Random();
lblRandom1.Text = "1st Number=" + rm.Next(1, 10).ToString();
lblRandom2.Text = "2nd Number=" + rm.Next(1, 10).ToString();
lblRandom3.Text = "3rd Number=" + rm.Next(1, 10).ToString();
lblRandom4.Text = "4th Number=" + rm.Next(1, 10).ToString();
lblRandom5.Text = "5th Number=" + rm.Next(1, 10).ToString();
}
}
0 comments:
Post a Comment