Category: Asp.net

How to refresh a page on click of a button in asp.net

{0 Comments}

to refresh asp.net web page using asp.net button control you can dynamically add following attribute which will call windows reload function  hence you page will be refreshed or reloaded after button press.  C# |  copy code |? 1Button1.Attributes.Add("onclick", "window.location.reload();");

Read More…

How to dynamically add button in asp.net

{0 Comments}

here is a simple syntax to add button in asp.net dynamically or say from code behind. Using this you can add your custom button to the webpage  C# |  copy code |? 1Button btn = new Button();2 btn.ID = "button1";3 btn.Text = "new button";4 form1.Controls.Add(btn);  

Read More…

How to set enter key on a button in asp.net

{0 Comments}

Here I have created a small syntax to set a enter key on a button in asp.net. There is no such event in asp.net. We can do this with the help of JavaScript. For doing this first take a asp.net button control then to assign a click event to it and all your associated code. …

Read More…

How to disable a button in asp.net

{0 Comments}

How to disable a button in asp.net

If you want to disable button after click on button in asp.net, then following syntax will help you. In this a JavaScript disable function is added dynamically to asp.net button on load. So that now if you click first time it works and after this it will disable. Here we are using add function in …

Read More…

How to add print button in asp.net

{0 Comments}

If you want add a print button in asp.net, and then you can access JavaScript’s print function through asp.net button.  In first way you can set the print function in on click event of button in designer mode, syntax for that is as follows: but I found it work for html submit tag better then …

Read More…

How to apply css to label control from code behind in asp.net

{0 Comments}

Following is the bunch of syntax which will help you to apply css styles from code behind c sharp which is as follows  C# |  copy code |? 1Label1.Text = "write what you want";2Label1.Font.Bold = true;3Label1.Font.Name = "arial";4Label1.Font.Size = FontUnit.Larger;5Label1.ForeColor = System.Drawing.Color.Red;6Label1.BackColor = System.Drawing.Color.PaleGreen;7Label1.BorderStyle = BorderStyle.Dashed;8Label1.BorderColor = System.Drawing.Color.PaleTurquoise;

Read More…

How to write string on web page in asp.net

{0 Comments}

In order to write string value to web page using c sharp in asp.net, we have to use a method know as response. Write method which will allow writing on a web page. Following is the easiest code snippets to write text on web page.  C# |  copy code |? 1Response.Write("hello world"); This response write method accept a parameter which …

Read More…

Do session variable use cookies.

{0 Comments}

In this article we will try to clarify a very important question. Does session variable use cookies? This is one of the favorite interview questions. Yes session variable use cookies, but internally. So what happens if somebody disables the cookies for the privacy reason? Then it won’t work, to still have a site with state …

Read More…