Category: Asp.net

How to change the color of disabled link button

{0 Comments}

We always get the same black boring text after the link button gets disabled. Most of time it gets merges in the text too. So after getting disable if you need to change color then you can follow these steps.  Create a css class for your disabled linkbutton mine is below.  CSS |  copy code |? 1<style type="text/css">2 .LnkBtn3 {4 …

Read More…

How to create dynamic linkbutton in asp.net

{0 Comments}

To create dynamic link button then use the following code which will remain same to make any control in asp.net. I have tested on many of them. And lastly don’t forget to add the same to the form of the asp.net page otherwise it will through an error. Then code for that is as follows. …

Read More…

Disable copy paste in pdf in asp.net

{0 Comments}

While you are making online book reading like website and you want that your user should not copy and paste your valuable pdf file then Google has provided way to make your pdf very secure. Follow this step and see the magic Most important requirement is that the pdf you want to show in secure …

Read More…

Disable copy paste in textbox asp.net

{0 Comments}

When you make a application where there is need of genuine user input, but most of time user tend to copy and paste in your provided text box where it is single line and multiline textbox. Then you can active these properties as shown below  C# |  copy code |? 1<asp:TextBox ID="TextBox1" oncopy="return false" onpaste="return false" oncut="return false"2 runat="server" />

Read More…

How to get browser close event in asp.net

{0 Comments}

in most of cases when there is need to do something on closing of the browser windows. In asp.net we can get the desired work done on closing event of browser.  For this we can use JavaScript which detect the close event and do some thing after detection.   Javascript |  copy code |? 1<script type="text/javascript">2 window.onbeforeunload = function(e) {3 // …

Read More…

How to add event to dynamic control (button) asp.net

{0 Comments}

When there is need to assign a event to an dynamically created button and controls. Then we can use Command Argument associated with that control. The value assigned to this command argument is passed to an event handler which will work in similar manner in which your default static button works. To understand this process …

Read More…

How to apply css style asp button code behind/server side

{0 Comments}

How to apply css style asp button code behind/server side

When it comes to apply css style from code behind/server side there are some properties which you can use to do so as we do to style many control. You can use following syntax to style your button according to your requirement.     C# |  copy code |? 01 protected void Button1_Click(object sender, EventArgs e)02 {03 Button1.BackColor = System.Drawing.Color.PaleGreen;04 Button1.BorderColor=System.Drawing.Color.PaleTurquoise;;05 Button1.BorderStyle=BorderStyle.Dashed;06 …

Read More…

How to avoid multiple button clicks asp net

{0 Comments}

Most of time when user click multiple time accidently, in some situation like submitting a form you need to restrict button click for some time then use following simple code. protected void server_btn_Click(object sender, EventArgs e) { server_btn.Enabled = false; }  C# |  copy code |? 1 protected void server_btn_Click(object sender, EventArgs e)2 {3 server_btn.Enabled = false;4 5 }

Read More…

How to call JavaScript function button click asp net

{0 Comments}

As per our requirement we have to call a java script function on the button click. For this we use traditional JavaScript calling procedure. This will be called on button click event, so the snippets for the code are as follows.   C# |  copy code |? 1protected void server_btn_Click(object sender, EventArgs e)2 {3 System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "script", "your_javascript_function_name()", true);4 }

Read More…