18 December 2012

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;
    }


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.
    Ff649643.des_MVC_Fig01(en-us,PandP.10).gif

    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.

  • 28 November 2012

    26 November 2012

    royalarun.blogspot.com menu

    C# and VB.Net :

    What is Dotnet Framework?

    Root namespace in dotnet framework

    What is Webservice in asp.net

    Base class for all classes in Dotnet framework

    Asp.net Page Life cycle Overview?

    Server.Transfer vs Response.Redirect

    Change File creation date and time Conversion in C#

    Bucket Problem in C# windows application

    Session state mode in asp.net

    Update Datatable in C#

    Common myths in Asp.net

    Windows Communication Foundation Overview

    WCF and Webservices

    Synclock and Lock in C#

    Lamda Expression in C#

    Anonymous type in C#

    Extension Method in C#

    String vs string in C#

    Use of Using statement in C#

    CalendarExtender show only years asp.net ajax control

    Check Connection string is valid or not in C#

    Event viewer read , write and Clear in C#

    Application path in windows application in C#

    Asp.net Path details - Absolute path and Relative path

    Use Application Wrapper Class To Access Web.Config Values

    Web application vs Web Service

    End Point, Address Binding in WCF

    Calling Javascript from server side in asp.net

    C# and VB.net Connectivity with Query string

    Debug the Windows server in Setup

    C# and Vb.net Connectivity using Stored Procedure

    Generics in Dotnet

    Boxing and Unboxing in Dotnet

    Response.redirect true vs False

    Asp.net Impersonation

    HTTP Status Code

    Session state mode in Asp.net

    Client side state management in asp.net

    Page life cycle event in asp.net

    Web application vs Website in Asp.net

    Cloud Computing Definition

    View State vs Hidden Fields in asp.net

    Adding datarelation in Datatable in C#

    Click the button when enter button is pressed in asp.net

    Naming Convention in Asp.net

    Export datatable in C# Windows application

    Calculate time Difference between two dates in Asp.net

    Webfarm in asp.net

    Webgarden in Asp.net

    When to use Generic Collection

    String is Immutable in C# and Java, Use of String builder in C#

    SqlBulk Copy in C#

    SqlHelper Class file from Microsoft in C#

    Hash table in C#

    Get Multiple Value from CheckedListbox control in C#

    List in C#

    Session vs Caching in asp.net

    Refer one asp.net page to another asp.net page

    Http modules in asp.net

    Http Handlers in asp.net

    Get the Function name,Line number,Columnnumber of the Error in C#

    What is Reflection and example

    Choose the right Generic collection type in Dotnet framework

    Difference between Assembly and Namespace in dotnet framework

    Partial Class in C#

    Why use Collections in Dotnet Framework

    Move next line in multiline textbox in C#

    Problem:Combobox Editable in C# Windows application and Asp.net
    Partial Class in C#

    Linq and XML in C#

    Connection string for C# and Vb.net

    Difference between typed dataset and untyped dataset in .Net framework

    What are the basic differences between user controls and custom controls?

    DELEGATES IN C#

    OUTPUT PARAMETER IN C#

    Advantages Of Visual Studio 2008

    Option Explicit statement and Option Strict Statement

    Difference Between Int32.Parse(), Convert.ToInt32(), and Int32.TryParse()

    E-mail Validation Using REGEX

    VB.NET VALIDATION USING ASCII

    C# VALIDATION USING ASCII


    Configuration system fail to initialize in C# windows application

    Single Click Selection - CheckListbox Change Property Double click to Single Click C# and VB.NET

    Disable remember password option in Firefox/Internet Explorer In Code

    How to Overcome multiline textbox [draggable] for mozilla firefox and Chrome Browser in asp.net

    WCF vs Webservice in asp.net

    COALESCE (Transact-SQL)


    OOPS
    Single responsibility principle in OOPS

    When to use Structure?

    When to use Delegates instead of Interface?

    When to Use Inheritance?

    Stack and Queue real time example

    Composition vs Inheritance in OOPS

    When to Use Abstract class

    When to use Interface ?

    Interface vs Abstract Class

    Single ton Class with example in C#

    Meaning For Dotnet First line of Code

    Difference Between ASP.NET Server Controls,HTML Server Controls and HTML Intrinsic Controls


    General

    What is Mobile apps?

    Difference between Sleep and Hibernate in Laptop

    Cloud computing - Overview

    Alternate tag for Html tag, while posting in blog

    To reset IIS

    Redbus Success Story

    Difference between 32 bit and 64 bit Processor

    Run Commands that can be used in both “Windows Operating System

    Difference Style of Communication

    Assertive Communication

    Link with in the page in HTML

    Sql Server Queries

    50 new features in Sql Sever 2008

    Sql Server Tips and Guidelines

    SSMS Tool Pack Free Download

    Sql Group by Function with Example

    Normalization types with example

    View in Sql Server with Example

    Get all the table name in Database Sql Server

    Delete all Stored Procedure in Sql Server

    Varchar vs nVarchar in Sql Server

    Sql Server Having Clause

    Copy one table to another in Sql Server

    Stored Procedure that change in Last n days

    Stored Procedure that create in n days in Sql Server

    Show the Stored Procedure Permission details in Sqlserver

    Query to Find Seed Values, Increment Values and Current Identity Column value of a table in Sqlserver

    Delete Column in Sql Server tables

    Script for renaming object in Sql Server

    Script for renaming table Column in Sql Server

    Select and Case statement in Sql Server

    Sql Server where 1=0

    Sql Server where 1=1

    While loop in Sql Server

    Pivot and Unpivot Query in Sql Server

    Display list of stored procedure using particular text in Sql Server

    Find the text in Stored Procedure in Sql Server

    Sql injection in Sql Server

    Hierarchy ID in Sql Server

    Try Catch in Sql Server

    Wait for in Sql Server 2008

    Trigger overview in Asp.net

    Difference between Primary key and Unique Key

    Different types of Database keys

    Difference between sp_executesql and EXEC() in Sql Server
    Microsoft SQL Server Constrains

    Uses of SET XACT_ABORT in Sql Server

    Dynamic Store Procedure in Sql Server

    Check String is null or empty in Sql Server

    Empty all table values in Sql Server

    Difference between Temporary table and Global Temporary table

    Trigger in Sql Server and types

    Difference between Oracle and Sql Server

    Difference between const and static readonly keywords C#

    SET NOCOUNT { ON | OFF } in DOT NET

    Introduction to Merge Statement – One Statement for INSERT, UPDATE, DELETE

    Insert Multiple Rows in a single statement in Sql Server 2008

    SQL PRIMARY KEY

    SQL FOREIGN KEY

    Difference between Stored procedure vs User Functions in Sql server

    Difference Between SCOPE_IDENTITY and ROWCOUNT in sql server

    Convert String to Datetime in Sql Server

    To Find Highest Salary, nth Highest Salary, Lowest Salary, nth Lowest Salary

    Coding to get nth record in sql server

    Trigger example in Sql Server

    PRIMARY KEY Constraints Primary key and Composite Primary key

    Get only Date in Sql Server



    20 November 2012

    Update Datatable in C#


    // Update Datatable in C#

    //Two methods to Update Datatable in C#

    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Data;
    using System.Linq;

    namespace DataTableUpdation
    {
        public partial class _Default : System.Web.UI.Page
        {
         
         
            protected void Page_Load(object sender, EventArgs e)
            {


                try
                {
                    DataTable dt = new DataTable();
                    //Add Datacolumn
                    DataColumn workCol = dt.Columns.Add("FirstName", typeof(String));

                    dt.Columns.Add("LastName", typeof(String));
                    dt.Columns.Add("Blog", typeof(String));
                    dt.Columns.Add("City", typeof(String));
                    dt.Columns.Add("Country", typeof(String));

                    //Add in the datarow
                    DataRow newRow = dt.NewRow();

                    newRow["firstname"] = "Arun";
                    newRow["lastname"] = "Prakash";
                    newRow["Blog"] = "http://royalarun.blogspot.com/";
                    newRow["city"] = "Coimbatore";
                    newRow["country"] = "India";

                    dt.Rows.Add(newRow);

       

                  // 1st method
                    // Get all DataRows where the name is the name you want.
                    IEnumerable< DataRow > rows = dt.Rows.Cast< DataRow >().Where( r => r["firstname"].ToString() == "Arun");
                    // Loop through the rows and change the name.
                    rows.ToList().ForEach(r => r.SetField("firstname", "AnotherName"));

                    // 2nd method
                    // Alternative approach.
                    // Simply loop through the rows, check the value of the Name field and change its value accordingly.
                    foreach (DataRow row in dt.Rows)
                    {
                        if (row["firstname"].ToString() == "AnotherName")
                            row.SetField("firstname", "Arun");
                    }

                }
                catch (Exception ex)
                {
                    throw ex;
                }


            }

        }
    }





    Consistency level in Azure cosmos db

     Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...