Passing the value from code behind to jquery ( using JSON )
Passing the value from code behind to jquery ( using JSON ) .ASPX File <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" OnClientClick="return CheckEmpID();" /> Script File function CheckEmpID() { var EmrID = document.getElementById("txtEmpId").value; if (EmpID == "Enter
How to use javascript variables in C# and vise versa
Passing values from server to client side (code-behind to .aspx) for some manipulation using javascript and passing values from script to code behind are one of the most recurring tasks while developing the application. This
Image is not displaying in master page
Issue : Image is not displaying in master page Solution : If you use html control in master page as like below line <img src="~/App_Themes/Images/company_logo.png" width="203" height="36"></div> then we want to include runat attribute inside
Removing Html tags
How to remove the html tags from the string. Code-Behind : public static string RemoveHTMLRegex(string strHTML) { string tmpHTML = Regex.Replace(strHTML, "<br />", " <br />"); return Regex.Replace(strHTML, "<.*?>", string.Empty); } namespace : using System.Text.RegularExpressions;
Copy data from div to ClipboardData using Jquery
How to copy div content form div to clipboard Code Behind File : Create string builder with some content and assign as like divcontent.InnerHtml = sbQuestionAndAnswers.ToString(); Design File: <div id="divcontent" style=" width: 1px; height: 1px;overflow:hidden;"
Nullable Types
Nullable Types Nullable types are variables that can be assigned with the value ‘null’. Allmost all value types can be declared as a nullable type. To declare a value type as a nullable type, you
Total minutes between two time value
How to get the difference of two time and get MM:SS of time Code Behind : DateTime locCurrentDateTime = System.DateTime.Now; TimeSpan difference = locCurrentDateTime.Subtract(Convert.ToDateTime(Session["starttime"])); double hrs = Math.Floor(difference.TotalMinutes); double sec = difference.Seconds; string time =
Finding the lable value after clicking the linkbutton inside the gridview
Finding the lable/any control value after clicking the linkbutton inside the gridview Code Behind File : protected void btnClick_Click(object sender, EventArgs e) { GridViewRow clickedRow = ((LinkButton)sender).NamingContainer as GridViewRow; Label lblID = (Label)clickedRow.FindControl("lblEmpID"); Session["patientEMRID"]