Sunday 15 June 2014

Copy to clipboard in asp.net c# code behind

using namespace-  System.Windows.Form

protected void btn_copyadd_Click(object sender, EventArgs e)

    {
        string addrs="Your text here"
        Val = addrs;
        System.Threading.Thread staThread = new System.Threading.Thread(new                                        System.Threading.ThreadStart(myMethod));
        staThread.ApartmentState = System.Threading.ApartmentState.STA;
        staThread.Start();
        lbl_title.Text = "Address";
        lbl_messages.Text = addrs;

        ModalAlert.Show();
}

 private static string _Val;
    public static string Val
    {
        get { return _Val; }
        set { _Val = value; }
    }
    public static void myMethod()
    {
        System.Windows.Forms.Clipboard.SetText(Val);

    }

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...