<asp:TextBox ID = "txtBox1" runat = "server" Text = "<%$appSettings:Keyvalue %>" />
Friday, April 27, 2012
How to make delay in page and after that redirect to another page using JAVASCRIPT
<script type="text/javascript">
function sleepMethod()
{
window.setTimeout("Delaymehod()",15000);
}
function Delaymehod()
{
var Redirect = '<%=ConfigurationManager.AppSettings["URLRedirect"].ToString() %>';
window.location = Redirect;
}
</script>
//Note:Here Time is measured in Mili second means 15000=15 seconds,so you can increase page delay time as your need.
How to get appsetting value in JAVASCRIPT using Asp.Net
function Delaymehod()
{
var Redirect = '<%=ConfigurationManager.AppSettings["URLRedirect"].ToString() %>';
window.location = Redirect;
}
Wednesday, April 25, 2012
How to call SSIS package in asp.net
1.to implement this,if u have SQL server 2005 then include reference of following dll and path is:
C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies :
1.Microsoft.SqlServer.SQLTaskConnectionsWrap.dll
2.Microsoft.SqlServer.TxScript.dll
3.Microsoft.SQLServer.ManagedDTS.dll
4.Microsoft.SqlServer.DTSPipelineWrap.dll
2.if u have SQL server 2008 then include reference of following dll and path is:
C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies :
1.Microsoft.SqlServer.SQLTaskConnectionsWrap.dll
2.Microsoft.SqlServer.TxScript.dll
3.Microsoft.SQLServer.ManagedDTS.dll
4.Microsoft.SqlServer.DTSPipelineWrap.dll
and in code behind include namespace like this:
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Microsoft.SqlServer.Server;
using Microsoft.SqlServer.Dts;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using Microsoft.SqlServer.Dts.Tasks.ScriptTask;
//Note: here i have put package in my local drive C:\Ajay\Package1.dtsx
protected void btnexecute_Click(object sender, EventArgs e)
{
try
{
Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();
Microsoft.SqlServer.Dts.Runtime.Package package = null;
package =(Microsoft.SqlServer.Dts.Runtime.Package) app.LoadPackage(@"C:\Ajay\Package1.dtsx",null,true);
Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
if (results == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)
{
foreach (Microsoft.SqlServer.Dts.Runtime.DtsError local_DtsError in package.Errors)
{
Console.WriteLine("Package Execution results: {0}", local_DtsError.Description.ToString());
Console.WriteLine();
}
}
}
catch (Exception ex)
{
string SS = ex.Message;
}
}
C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies :
1.Microsoft.SqlServer.SQLTaskConnectionsWrap.dll
2.Microsoft.SqlServer.TxScript.dll
3.Microsoft.SQLServer.ManagedDTS.dll
4.Microsoft.SqlServer.DTSPipelineWrap.dll
2.if u have SQL server 2008 then include reference of following dll and path is:
C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies :
1.Microsoft.SqlServer.SQLTaskConnectionsWrap.dll
2.Microsoft.SqlServer.TxScript.dll
3.Microsoft.SQLServer.ManagedDTS.dll
4.Microsoft.SqlServer.DTSPipelineWrap.dll
and in code behind include namespace like this:
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Microsoft.SqlServer.Server;
using Microsoft.SqlServer.Dts;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using Microsoft.SqlServer.Dts.Tasks.ScriptTask;
//Note: here i have put package in my local drive C:\Ajay\Package1.dtsx
protected void btnexecute_Click(object sender, EventArgs e)
{
try
{
Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();
Microsoft.SqlServer.Dts.Runtime.Package package = null;
package =(Microsoft.SqlServer.Dts.Runtime.Package) app.LoadPackage(@"C:\Ajay\Package1.dtsx",null,true);
Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
if (results == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)
{
foreach (Microsoft.SqlServer.Dts.Runtime.DtsError local_DtsError in package.Errors)
{
Console.WriteLine("Package Execution results: {0}", local_DtsError.Description.ToString());
Console.WriteLine();
}
}
}
catch (Exception ex)
{
string SS = ex.Message;
}
}
Monday, April 23, 2012
Validating gridview footer row for adding new items using asp.net
<asp:GridView ID="grdPresentAddress" runat="server"
DataKeyNames="CustID,ClientID,AddressID" AutoGenerateColumns="false"
GridLines="None" ShowFooter="True"
>
<Columns>
<asp:TemplateField ItemStyle-Width = "400px" HeaderText = "Customer Name" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<ItemTemplate>
<asp:Label ID="lblContactName" runat="server"
Text='<%# Eval("ContactName")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtContactName" runat="server"
Text='<%# Eval("ContactName")%>' ></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtContactName" runat="server" Width="80%"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireInsertName" runat="server"
ControlToValidate="txtContactName"
Display="Dynamic"
SetFocusOnError="true" ValidationGroup="Test">*</asp:RequiredFieldValidator>
</FooterTemplate>
<ItemStyle Width="400px" />
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width = "400px" HeaderText = "House Number/Name" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<ItemTemplate>
<asp:Label ID="lblHouseAddress" runat="server"
Text='<%# Eval("HouseAddress")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtHouseAddress" runat="server"
Text='<%# Eval("HouseAddress")%>' ></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtHouseAddress" runat="server" Width="80%"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireInsertHouseadd" runat="server"
ControlToValidate="txtHouseAddress"
Display="Dynamic"
SetFocusOnError="true" ValidationGroup="Test">*</asp:RequiredFieldValidator>
</FooterTemplate>
<ItemStyle Width="400px" />
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width = "400px" HeaderText = "City" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<ItemTemplate>
<asp:Label ID="lblCity" runat="server"
Text='<%# Eval("City")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtCity" runat="server"
Text='<%# Eval("City")%>' ></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtCity" runat="server" Width="80%"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireInsertCity" runat="server"
ControlToValidate="txtCity"
Display="Dynamic"
SetFocusOnError="true" ValidationGroup="Test">*</asp:RequiredFieldValidator>
</FooterTemplate>
<ItemStyle Width="400px" />
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width = "400px" HeaderText = "State" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<ItemTemplate>
<asp:Label ID="lblState" runat="server"
Text='<%# Eval("State")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtState" runat="server"
Text='<%# Eval("State")%>' ></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtState" runat="server" Width="80%"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireInsertState" runat="server"
ControlToValidate="txtState"
Display="Dynamic"
SetFocusOnError="true" ValidationGroup="Test">*</asp:RequiredFieldValidator>
</FooterTemplate>
<ItemStyle Width="400px" />
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width = "400px" HeaderText = "Locality" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<ItemTemplate>
<asp:Label ID="lblLocality" runat="server"
Text='<%# Eval("Locality")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtLocality" runat="server"
Text='<%# Eval("Locality")%>' ></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtLocality" runat="server" Width="80%"></asp:TextBox>
<%-- <asp:RequiredFieldValidator ID="valRequireInsertLocality" runat="server"
ControlToValidate="txtLocality"
Display="Dynamic"
SetFocusOnError="true" ValidationGroup="Test">*</asp:RequiredFieldValidator>--%>
</FooterTemplate>
<ItemStyle Width="400px" />
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width = "400px" HeaderText = "Post Code" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<ItemTemplate>
<asp:Label ID="lblPostCode" runat="server"
Text='<%# Eval("PostCode")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtPostCode" runat="server"
Text='<%# Eval("PostCode")%>' ></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtPostCode" runat="server" Width="80%"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireInsertPcode" runat="server"
ControlToValidate="txtPostCode"
Display="Dynamic"
SetFocusOnError="true" ValidationGroup="Test">*</asp:RequiredFieldValidator>
</FooterTemplate>
<ItemStyle Width="400px" />
</asp:TemplateField>
<asp:TemplateField>
<FooterTemplate>
<asp:Button ID="btnAddress" runat="server" Text="Add" CssClass="button" CommandName="AddAddressdetails" onclick="AddAddressdetails" ValidationGroup="Test" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="grid_heading_left" />
<RowStyle CssClass="grid_row1" />
<AlternatingRowStyle CssClass="grid_row2" />
</asp:GridView>
Monday, April 16, 2012
how to set gridview dropdown selectedindex using datakey on page_Load event
if (grdInvoices.DataKeys[e.Row.RowIndex].Values[3].ToString() != "")
{
ddl.Items.FindByText(grdInvoices.DataKeys[e.Row.RowIndex].Values[3].ToString()).Selected = true;
}
How to find Datakey value on RawdataBound Event of Gridview
1.
<asp:GridView ID="grdInvoices" runat="server"
DataKeyNames="InvoiceID,ClientID,CustID,SourceDesc" AutoGenerateColumns="false"
GridLines="None" onrowdatabound="grdInvoices_RowDataBound"
onrowcommand="grdInvoices_RowCommand">
<Columns>
<asp:BoundField DataField="InvoiceDate" HeaderText ="Invoice Date" ItemStyle-Width="150" />
<asp:BoundField DataField="InvoiceNumber" HeaderText ="Invoice Number" ItemStyle-Width="150" />
<asp:BoundField DataField="InvoiceAmount" HeaderText ="Invoice Amout" ItemStyle-Width="150" />
<asp:BoundField DataField="TermsOfPayment" HeaderText ="Term Of Payment" ItemStyle-Width="150" />
<asp:templatefield headertext="Source Description">
<itemtemplate>
<asp:dropdownlist id="ddlSourceDesc" runat="server">
</asp:dropdownlist>
</itemtemplate>
</asp:templatefield>
<asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="10%">
<ItemTemplate>
<asp:Button ID="btnAdd" runat="server" Text="Save" CssClass="button" CommandName="SaveSourceDes"/>
</ItemTemplate>
<HeaderStyle Width="10%"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="grid_heading_left" />
<RowStyle CssClass="grid_row1" />
<AlternatingRowStyle CssClass="grid_row2" />
</asp:GridView>
2. Reterive Datakey value
string Binbdval=grdInvoices.DataKeys[e.Row.RowIndex].Values[3].ToString();
ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(Binbdval));
How to find control and datakey value in Gridview RowCommand event
protected void grdInvoices_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName.Equals("SaveSourceDes"))
{
Control ctrl = e.CommandSource as Control;
if (ctrl != null)
{
GridViewRow _currenrtrow = ctrl.Parent.NamingContainer as GridViewRow;
//Now you can find control on the row where event is raised by using FindControl method.
DropDownList findme =(DropDownList) _currenrtrow.FindControl("ddlSourceDesc");
ObjSys.pSourceDiscription=findme.SelectedValue.ToString();
if (ObjSys.pSourceDiscription == "SELECT")
{
}
else
{
// Get the datakey value
GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer;
int InvoId = Convert.ToInt32(grdInvoices.DataKeys[row.RowIndex].Value);
ObjSys.pInvoiceID = InvoId;
ObjSys.UpdateInvoiceSourceDesc();
}
}
//int index = Convert.ToInt32(e.CommandSource.ToString());
//GridViewRow row = grdInvoices.Rows[index];
//DropDownList lstState = (DropDownList)row.FindControl("ddlSourceDesc");
}
}
Binding Dropdown in Gridview
protected void grdInvoices_RowDataBound(object sender, GridViewRowEventArgs e)
{
DataTable mytable = new DataTable();
DataColumn productidcolumn = new DataColumn("SourceKey");
DataColumn productnamecolumn = new DataColumn("SourceDescription");
mytable.Columns.Add(productidcolumn);
mytable.Columns.Add(productnamecolumn);
DataSet ds = new DataSet();
ds = DataBinder();
int categoryid = 0;
string expression = string.Empty;
if (e.Row.RowType == DataControlRowType.DataRow)
{
//categoryid = Int32.Parse(e.Row.Cells[0].Text);
//Get the DataKey value in case you set the DataKeyname in your GridView
string key = grdInvoices.DataKeys[e.Row.RowIndex].Value.ToString();
expression =key;
DropDownList ddl = (DropDownList)e.Row.FindControl("ddlSourceDesc");
DataRow[] rows = ds.Tables[0].Select();
foreach (DataRow row in rows)
{
DataRow newrow = mytable.NewRow();
newrow["SourceKey"] = row["SourceKey"];
newrow["SourceDescription"] = row["SourceDescription"];
mytable.Rows.Add(newrow);
}
ddl.DataSource = mytable;
ddl.DataTextField = "SourceDescription";
ddl.DataValueField = "SourceKey";
ddl.DataBind();
}
}
public DataSet DataBinder()
{
SystemProblems ObjSys = new SystemProblems();
ObjSys.pClientId = clsSessions.sesClientId;
DataSet ds = new DataSet();
ds = ObjSys.BindData();
return ds;
}
public DataSet BindData()
{
sqlParam = new SqlParameter[1];
sqlParam[0] = new SqlParameter("@CID", SqlDbType.VarChar, 50);
sqlParam[0].Value = _lClientId;
objMgr = new Manager();
DataSet dsClients;
dsClients = objMgr.executeQuery("cs_GetSystemProblemSource", sqlParam, "tblSysProblem");
return (dsClients);
}
Thursday, April 12, 2012
Call Jquery function in Content page and Normal aspx page
For Normal Page:
Note:If we use normal aspx page then we pass form ID in Jquery function for calling metheds of Jquery
<script src="jscripts/jquery-1.6.min.js" type="text/javascript"></script>
<script src="jscripts/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
<script src="jscripts/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
<script type="text/jscript">
jQuery(document).ready(function(){
jQuery("#form1").validationEngine();
});
</script>
For Content page:
here we paas content page id which become as aspnetForm in running form(check for this in viewsource of content page)
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" />
<link rel="stylesheet" href="css/template.css" type="text/css" />
<script src="jscripts/jquery-1.6.min.js" type="text/javascript"></script>
<script src="jscripts/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
<script src="jscripts/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
<script type="text/jscript">
jQuery(document).ready(function(){
jQuery("#aspnetForm").validationEngine();
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table cellpadding="0" cellspacing="0" border="0" width="60%" align="center" id="tbl">
<tr>
<td class="report_heading" colspan="2">
Change Password</td>
</tr>
<tr>
<td class="grid_row1" colspan="2">
<asp:Label ID="LblMsg" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td class="grid_row1">
Email ID:<font color="#CC0000">*</font></td>
<td class="grid_row1">
<asp:TextBox ID="txtEmailId" class="validate[required,custom[email]]" Width="348" runat="server" /></td>
</tr>
<tr>
<td class="grid_row1">
New Passowrd:<font color="#CC0000">*</font></td>
<td class="grid_row1">
<asp:TextBox ID="txtPassword" class="validate[required,custom[min]]" Width="348" runat="server" TextMode="Password"/></td>
</tr>
<tr>
<td class="grid_row1">
Confirm Passowrd:<font color="#CC0000">*</font></td>
<td class="grid_row1">
<asp:TextBox ID="txtConfirmPass" class="validate[required,equals[ctl00_ContentPlaceHolder1_txtPassword]]" Width="348" runat="server" TextMode="Password" /> </td>
</tr>
<tr>
<td class="grid_row1">
</td>
<td class="grid_row1">
<asp:Button ID="Submit" runat="server" CssClass="button" Text="Submit"
onclick="Submit_Click" /></td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
</table>
</asp:Content>
Note:If we use normal aspx page then we pass form ID in Jquery function for calling metheds of Jquery
<script src="jscripts/jquery-1.6.min.js" type="text/javascript"></script>
<script src="jscripts/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
<script src="jscripts/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
<script type="text/jscript">
jQuery(document).ready(function(){
jQuery("#form1").validationEngine();
});
</script>
For Content page:
here we paas content page id which become as aspnetForm in running form(check for this in viewsource of content page)
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" />
<link rel="stylesheet" href="css/template.css" type="text/css" />
<script src="jscripts/jquery-1.6.min.js" type="text/javascript"></script>
<script src="jscripts/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
<script src="jscripts/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
<script type="text/jscript">
jQuery(document).ready(function(){
jQuery("#aspnetForm").validationEngine();
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table cellpadding="0" cellspacing="0" border="0" width="60%" align="center" id="tbl">
<tr>
<td class="report_heading" colspan="2">
Change Password</td>
</tr>
<tr>
<td class="grid_row1" colspan="2">
<asp:Label ID="LblMsg" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td class="grid_row1">
Email ID:<font color="#CC0000">*</font></td>
<td class="grid_row1">
<asp:TextBox ID="txtEmailId" class="validate[required,custom[email]]" Width="348" runat="server" /></td>
</tr>
<tr>
<td class="grid_row1">
New Passowrd:<font color="#CC0000">*</font></td>
<td class="grid_row1">
<asp:TextBox ID="txtPassword" class="validate[required,custom[min]]" Width="348" runat="server" TextMode="Password"/></td>
</tr>
<tr>
<td class="grid_row1">
Confirm Passowrd:<font color="#CC0000">*</font></td>
<td class="grid_row1">
<asp:TextBox ID="txtConfirmPass" class="validate[required,equals[ctl00_ContentPlaceHolder1_txtPassword]]" Width="348" runat="server" TextMode="Password" /> </td>
</tr>
<tr>
<td class="grid_row1">
</td>
<td class="grid_row1">
<asp:Button ID="Submit" runat="server" CssClass="button" Text="Submit"
onclick="Submit_Click" /></td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
</table>
</asp:Content>
Tuesday, April 10, 2012
Bold Specific item of drop down in c#
If we apply style on drop down for maiking specific item bold,it will work in Firefox but not in IE.
So for overcome this problem,we should make that item to bold before binding it to dropdown.
var item = new ListItem("MyItem");
item.Attributes.Add("style", "font-weight: bold");
var list = FindControl("DropDownList1");
list.Items.Add(item);
Querystring In item template of Gridview
<asp:TemplateField HeaderText="View details">
<ItemTemplate>
<a href = 'customerdetails.aspx?cid=<%#Eval("clientid")%>&custID=<%#Eval("CustID") %>' target="_blank">View Details</a>
</ItemTemplate>
</asp:TemplateField>
Monday, April 9, 2012
Unique Random Number Generation in asp.net
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
private static Random random = new Random((int)DateTime.Now.Ticks);
protected void Page_Load(object sender, EventArgs e)
{
// get 1st random string
string RandNum1 = RandomStringMehtod(4);
// get 2nd random string
string RandNum2 = RandomStringMehtod(4);
// create full random string
string FinalNum = RandNum1 + "-" + RandNum2;
}
private string RandomStringMehtod(int size)
{
StringBuilder sb = new StringBuilder();
char ch;
for (int i = 0; i < size; i++)
{
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
sb.Append(ch);
}
return sb.ToString();
}
}
Subscribe to:
Posts (Atom)