Dotnet, DotnetCore, Azure, C#,VB.net, Sql Server, WCF, MVC ,Linq, Javascript and Jquery
18 December 2012
Click the button using Javascript
Click the button using Javascript
document.getElementById("btnSearch").click();
Javascript Empty validation in Asp.net
Javascript Empty validation
function CheckEmpty() {
try {
if (document.getElementById("txtClientNumber").value.trim() == "") {
alert("Must enter a Client Number");
return false;
}
}
catch (e) {
}
}
calling javascript from server side
btnAdd.Attributes.Add("onclick", "return CheckEmpty();")
Asp.net Gridview mouseover, mouseout color change in C#
Asp.net Gridview mouseover, mouseout color change in C#
protected void grd_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.color='Red'";
e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';this.style.color='Black'";
e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.grd, "Select$" + e.Row.RowIndex);
}
}
catch (Exception ex)
{
throw ex;
}
}
Confirm ok/cancel in Javascript in Asp.net
Confirm ok/cancel in Javascript in Asp.net
function askConfirm()
{
if (confirm("Are you sure want to overwrite the file")) {
}
else {
return false;
}
function askConfirm()
{
if (confirm("Are you sure want to overwrite the file")) {
}
else {
return false;
}
Calling js from server side coding in Asp.net
ScriptManager.RegisterStartupScript(this, GetType(), "YourUniqueScriptKey", "askConfirm();", true);
Stored Procedure used to search the word in the Database Sql Server
Below Stored Procedure used to search the word in the Database Sql Server
/*
Test Script:
exec Find_Text_In_SP 'Searchword'
*/
CREATE Procedure dbo.Find_Text_In_SP(
@SearchString AS VARCHAR(500)
)
AS
BEGIN
SET NOCOUNT ON
SELECT name
FROM
sysobjects
WHERE
id IN
(SELECT id
FROM
syscomments
WHERE
text LIKE '%' + @SearchString + '%')
ORDER BY
name
END
14 December 2012
The MVC Programming Model in Asp.net
The MVC Programming Model in Asp.net
MVC is one of three ASP.NET programming models.
MVC is a framework for building web applications using a MVC (Model View Controller) design:
The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes:
Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).
View. The view manages the display of information.
Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.
It is important to note that both the view and the controller depend on the model. However, the model depends on neither the view nor the controller. This is one the key benefits of the separation. This separation allows the model to be built and tested independent of the visual presentation. The separation between view and controller is secondary in many rich-client applications, and, in fact, many user interface frameworks implement the roles as one object. In Web applications, on the other hand, the separation between view (the browser) and controller (the server-side components handling the HTTP request) is very well defined.
Subscribe to:
Posts (Atom)
Implementing OAuth validation in a Web API
I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...
-
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...