skip to main |
skip to sidebar
params is used on such situations where the number of arguments to a method is not known until runtime. If you prefix the params keyword followed by the type as array without size, then you can pass as many arguments as you want.
Ex:
using System;
using System.Collections.Generic;
using System.Text;
namespace ParamSample
{
class Program
{
public static void PrintWords(params String[] p)
{
for (int i = 0; i < p.GetLength(0); i++)
{
System.Console.WriteLine(p[i]);
System.Console.Read();
}
}
static void Main(string[] args)
{
PrintWords("1","2","3");
}
}
}
www.codecollege.NET
params is used on such situations where the number of arguments to a method is not known until runtime. If you prefix the params keyword followed by the type as array without size, then you can pass as many arguments as you want.
Ex:
using System;
using System.Collections.Generic;
using System.Text;
namespace ParamSample
{
class Program
{
public static void PrintWords(params String[] p)
{
for (int i = 0; i < p.GetLength(0); i++)
{
System.Console.WriteLine(p[i]);
System.Console.Read();
}
}
static void Main(string[] args)
{
PrintWords("1","2","3");
}
}
}
www.codecollege.NET
If you want to associate a control with Label, then you can give an access key to the label control and set the AssociatedControlID property of the Label to the control to which you want the label to associate. When you do so, upon clicking the AccessKey Focus will be set to the Associated Control.
Ex:
<form id="form1" runat="server">
<div>
<asp:Label ID="lblName" runat="server" AccessKey="N" AssociatedControlID="TextBox1"
Text="Name"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" AccessKey="B" OnClick="Button1_Click" /></div>
</form>
www.codecollege.NET
If you want to associate a control with Label, then you can give an access key to the label control and set the AssociatedControlID property of the Label to the control to which you want the label to associate. When you do so, upon clicking the AccessKey Focus will be set to the Associated Control.
Ex:
<form id="form1" runat="server">
<div>
<asp:Label ID="lblName" runat="server" AccessKey="N" AssociatedControlID="TextBox1"
Text="Name"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" AccessKey="B" OnClick="Button1_Click" /></div>
</form>
www.codecollege.NET
You can do that by setting the AccessKey attribute of the button.
Ex:
<asp:Button ID="btnTest" runat="server" AccessKey="T" Text="Test" OnClick="btnTest_Click" />
www.codecollege.NET
You can do that by setting the AccessKey attribute of the button.
Ex:
<asp:Button ID="btnTest" runat="server" AccessKey="T" Text="Test" OnClick="btnTest_Click" />
www.codecollege.NET
You can do that by setting the DefaultButton attribute of the form in which the button is present.
Ex:
<form id=f1 defaultbutton="btnSubmit" runat="server">
<asp:textbox id="textbox1" runat="server"/>
<asp:button id="button1" text="btnSubmit" runat="server"/>
</form>
www.codecollege.NET