In this web programming tutorial we will learn that how we can creat a image button dynamically in asp.net using c#.
See the below code for your .cs file
in my case i have created a print button you may create a button as per your requirements.
See the below code for your .cs file
in my case i have created a print button you may create a button as per your requirements.
ImageButton imgButton = new ImageButton(); imgButton.ID = "img1"; imgButton.CausesValidation = false; imgButton.ImageUrl = "../img/printer_icon.gif"; string targeturl = "http://localhost:8000" + Request.RawUrl.ToString(); //imgButton.OnClientClick = "javascript:return OpenNewWindow('" + targeturl + "')"; imgButton.Click += new ImageClickEventHandler(ImageButton1_Click); imgButton.ToolTip = "Print"; cc.Controls.Add(imgButton);
No comments:
Post a Comment