Tag: asp.net

Formatting ASP.net GridView

Author: | Categories: Programming No Comments
Formatting ASP.net GridView BoundField For Date and Time DataFormatString="{0:d-MMM-yyyy}" For Decimals DataFormatString="{0:F2}" For Currency DataFormatString="{0:C2}" For Percentage DataFormatString="{0:P2}"

ASP.NET Send Canvas to Server as File Using Ajax

Author: | Categories: Programming No Comments
HTML 5 introduces canvas element as a resolution-dependent bitmap canvas which can be used for rendering graphs, game graphics, or other visual images on the fly. A canvas is a rectangle in your page where you can use JavaScript to draw anything you want. Below is the code save graphics drawn on Canvas to server […]

ASP.Net persist readonly textbox value on postback

Author: | Categories: Programming No Comments
As a security measure in the asp.net the readonly fields and disabled fields loose their values in postbacks. To retain the readonly textbox value after postback instead of making the textbox readonly using properties option, use attributes in code: TextBox1.Attributes.Add(“readonly”, “readonly”); that will still make the textbox readonly and will also retain the value after […]

ASP.NET calling Webmethod using jQuery

Author: | Categories: Programming No Comments
To call Webmethod asynchronously in ASP.net through jQuery Javascript Code <script type=”text/javascript”> function Authenticate() { $.ajax({ type: "POST", url: "/login.aspx/Authenticate", data: "{ provide json data }", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { if (msg.d == '1') { alert(‘authenticated’); } else { alert("not authenticated"); } }, error: function() { alert("Error :("); } }); }; […]