Generate Random Alphanumeric Strings
Generate Random Alphanumeric Strings Like Small & Captial Letters ,Numbers With Combine Particular Length String Display Using Asp.Net C#.
DEMO
Next - Button Click - Assign String & Char Length To Random
Next - Run[F5] - Get The Random Alphanumeric String in Label
Generate Random Alphanumeric Strings Like Small & Captial Letters ,Numbers With Combine Particular Length String Display Using Asp.Net C#.
DEMO
HTML CODING
C# CODING
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
char[] CharsString = new char[10];
Random random = new Random();
for (int i = 0; i < CharsString.Length; i++)
{
CharsString[i] =
chars[random.Next(chars.Length)];
}
string Result = new String(CharsString);
lblRandomString.Text = Result;
}
}
First Add - New WebForm - Select Label & Button From Toolbox - Change Label Id
Next - Button Click - Assign String & Char Length To Random
Next - Run[F5] - Get The Random Alphanumeric String in Label
0 comments:
Post a Comment