Currently, I have this all laid out:
public static string Encrypt<T>(string anything)
{
//Stuff can go here
}
When I press a button, I want to be able to run ALL the code in Encrypt. Is it possible to do this, and if it is, how can I?
Suppose your aspx button is
<asp:Button runat="server" text="Encrypt" id="btnencrypt" onclick="btnencrypt_Click" />
Your server side event will be like this:
protected void btnencrypt_Click(object sender,EventArgs e)
{
// Supposing that the Encrypt method is not in the current class.
OtherClass.Encrypt(anystring);
}
If the Encrypt method is in the same class then you can directly write the method name like:
Encrypt(anystring);
You don't need the . So your Encrypt method will be like:
public static string Encrypt(string inputstring)
{
//Encryption code.
}
Hope u get your answer from this...
Let's say your button in your ASPX could be written this way:
<asp:Button runat="server" text="Encrypt" onclick="encrypt_click" />
Let's say the cs page behind your ASPX page (Code-behind) could be written like
protected void encrypt_click(object sender, EventArgs e)
{
Encrypt(text);
}
Is this what you are looking for?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.