Profile cover photo
Profile photo Tutorial
Collection of and C# articals
Collection of and C# articals

About Tutorial's posts

Database Model Concepts
This section covers the basic concepts for models used in database systems. At the end, the object and relational models are compared. Click on the links below.
 Object Model Concepts
 Relational Model Concepts
 Comparing Object and Relational Models

Object Model Concepts
Three concepts are critical to understanding object models. They are:
 Data Abstraction
 Encapsulation
 Inheritance
Data Abstraction
Data abstraction is the process of distilling data down to its essentials. In an object schema, the abstract data model is implemented as a graph. The following figure shows such a graph structure for a genealogical database. For more information on data abstraction, see the items under "more detail" below. For another example of data abstraction, see the complex data.
Encapsulation Object Model Concept
Encapsulation is the object model concept of including processing or behavior with the object instances defined by the class. Encapsulation allows code and data to be packaged together.
The definition of methods for a class is an integral part of encapsulation. A method is programming code that performs the behavior an object instance can exhibit. Calculating the age of a person would be an example of such behavior. The figure shows a way of looking at encapsulating the age method with an instance object. The code for the age method is "attached" to or encapsulated with the object rather than part of the application.
More on encapsulation.

Inheritance Object Model Concept
Inheritance in the object model is a means of defining one class in terms of another. This is common usage for most of us. For example, a conifer is a type of tree. There are certain characteristics that are true for all trees, yet there are specific characteristics for conifers.
Note that in an object model, there is no distinction in usage between system pre-defined types and user-defined types. This is known as extensibility. So it is possible to define a type as a sub-type of a system type or as a sub-type of a user-define type.

Relational Model Concepts
The relational model used the basic concept of a relation or table. The columns or fields in the table identify the attributes such as name, age, and so. A tuple or row contains all the data of a single instance of the table such as a person named Doug. In the relational model, every tuple must have a unique identification or key based on the data. In this figure, a social security account number (SSAN) is the key that uniquely identifies each tuple in the relation. Often, keys are used to join data from two or more relations based on matching identification. The relational model also includes concepts such as foreign keys, which are primary keys in one relation that re kept in another relation to allow for the joining of data. As an example of foreign keys is storing your mother's and father's SSAN in the tuple that represent you. Your parents' SSANs are keys for the tuples that represent them and they are foreign keys in the the tuple that represents you.

Comparing Object and Relational Models
I have often asked whether an RDBMS or an ODBMS is better. The answer, of course, is that there is no one right answer to this question. RDBMSs might be better in one situation while ODBMSs might be better in another.
The links in the related content below compare the terminology and concepts of relational and object technology.

When you want to use the result integrated as part of a larger query.

e.g. you can join or cross apply table valued functions and you can evaluate a Scalar UDF for each row in a result (with care as this can have performance implications).

For stored procedures you would need to execute them and capture the result into a temporary table etc to be able to join on it in a wider query and would require cursors or similar to simulate the Scalar UDF behaviour and execute it for each row.

ACID Properties
ACID properties are an important concept for databases. The acronym stands for Atomicity, Consistency, Isolation, and Durability.
The ACID properties of a DBMS allow safe sharing of data. Without these ACID properties, everyday occurrences such using computer systems to buy products would be difficult and the potential for inaccuracy would be huge. Imagine more than one person trying to buy the same size and color of a sweater at the same time -- a regular occurrence. The ACID properties make it possible for the merchant to keep these sweater purchasing transactions from overlapping each other -- saving the merchant from erroneous inventory and account balances.
Related Articles
ACID Properties
 Atomicity
 Consistency
 Isolation
 Durability

The phrase "all or nothing" succinctly describes the first ACID property of atomicity. When an update occurs to a database, either all or none of the update becomes available to anyone beyond the user or application performing the update. This update to the database is called a transaction and it either commits or aborts. This means that only a fragment of the update cannot be placed into the database, should a problem occur with either the hardware or the software involved. Features to consider for atomicity:
 a transaction is a unit of operation - either all the transaction's actions are completed or none are
 atomicity is maintained in the presence of deadlocks
 atomicity is maintained in the presence of database software failures
 atomicity is maintained in the presence of application software failures
 atomicity is maintained in the presence of CPU failures
 atomicity is maintained in the presence of disk failures
 atomicity can be turned off at the system level
 atomicity can be turned off at the session level
Consistency is the ACID property that ensures that any changes to values in an instance are consistent with changes to other values in the same instance. A consistency constraint is a predicate on data which serves as a precondition, post-condition, and transformation condition on any transaction.

The isolation portion of the ACID Properties is needed when there are concurrent transactions. Concurrent transactions are transactions that occur at the same time, such as shared multiple users accessing shared objects. This situation is illustrated at the top of the figure as activities occurring over time. The safeguards used by a DBMS to prevent conflicts between concurrent transactions are a concept referred to as isolation.
As an example, if two people are updating the same catalog item, it's not acceptable for one person's changes to be "clobbered" when the second person saves a different set of changes. Both users should be able to work in isolation, working as though he or she is the only user. Each set of changes must be isolated from those of the other users.

An important concept to understanding isolation through transactions is serializability. Transactions are serializable when the effect on the database is the same whether the transactions are executed in serial order or in an interleaved fashion. As you can see at the top of the figure, Transactions 1 through Transaction 3 are executing concurrently over time. The effect on the DBMS is that the transactions may execute in serial order based on consistency and isolation requirements. If you look at the bottom of the figure, you can see several ways in which these transactions may execute. It is important to note that a serialized execution does not imply the first transactions will automatically be the ones that will terminate before other transactions in the serial order.
Degrees of isolation1:
 degree 0 - a transaction does not overwrite data updated by another user or process ("dirty data") of other transactions
 degree 1 - degree 0 plus a transaction does not commit any writes until it completes all its writes (until the end of transaction)
 degree 2 - degree 1 plus a transaction does not read dirty data from other transactions
 degree 3 - degree 2 plus other transactions do not dirty data read by a transaction before the transaction commits

Maintaining updates of committed transactions is critical. These updates must never be lost. The ACID property of durability addresses this need. Durability refers to the ability of the system to recover committed transaction updates if either the system or the storage media fails. Features to consider for durability:
 recovery to the most recent successful commit after a database software failure
 recovery to the most recent successful commit after an application software failure
 recovery to the most recent successful commit after a CPU failure
 recovery to the most recent successful backup after a disk failure
 recovery to the most recent successful commit after a data disk failure

Post has attachment
var vs dynamic vs object

Post has attachment

Post has attachment
Test the WebService by passing the parameter value in the URL

Keyboard Shortcut Keys for Visual Studio 2008, 2010, 2012
Keyboard shortcut keys for 2012, 2010 and 2008.Using this keyboard shortcut keys for visual studio we can easily navigate without using mouse
Project Related Shortcut Keys
Builds the solution
Displays the New File dialog. Note: files created this way are not associated with a project. Use Ctrl-Shift-A to add a new file in a project
Displays the New Project dialog
Displays the Open File dialog
Displays the Open Project dialog
Displays the Add Existing Item dialog
Displays the Add New Item dialog
Allows you to override base class methods in a derived class when an overridable method is highlighted in the Class View pane
Collapse all the methods, classes, regions in the current code behind or class file
Ctrl-M-P or Ctrl-M-L
Expands all the methods, classes, regions in the current code behind or class file
Displays the Find dialog
Displays the Replace dialog
Find the reference of selected item into entire solution.
Move from one opened file to another opened file in visual studio.
Sets or removes a breakpoint at the current line
Enables or disables the breakpoint on the current line of code. The line must already have a breakpoint for this to work
Runs the code with invoking the debugger.
Runs the code without invoking the debugger.
F4 or Alt-Enter
Displays the Properties window, which lists the design-time properties and events for the currently selected item
Displays the Server Explorer window, which allows you to view and manipulate database servers, event logs, message queues, web services, and many other operating system services
Displays the Solution Explorer, which lists the projects and files in the current solution
Displays the Toolbox, which contains controls and other items that can be dragged into editor and designer windows
Displays the Immediate window, where you can find the controls or variables values or can do data manipulation during debugging
Text Manipulation Shortcut Keys
Moves current line or selected lines one tab stop to the left
Backspace or
Deletes one character to the left of the cursor
Go to Particular line
Ctrl-K, Ctrl-C
Marks the current line or selected lines of code as a comment, using the correct comment syntax for the programming language
Ctrl-K, Ctrl-U
Removes the comment syntax from the current line or currently selected lines of code
Ctrl-T or
Swaps the characters on either side of the cursor. (For example, AC|BD becomes AB|CD.) Available only in text editors
Ctrl-K, Ctrl-L
Removes all unnamed bookmarks in the current document
Ctrl-M, Ctrl-O
Automatically determines logical boundaries for creating regions in code, such as procedures, and then hides them. This collapses all such regions in the current document
Alt-Right Arrow or
Displays statement completion based on the current language or autocompletes word if existing text unambiguously identifies a single symbol
Ctrl-K, Ctrl-\
Removes horizontal whitespace in the selection or deletes whitespace adjacent to the cursor if there is no selection
Ctrl-K, Ctrl-F
Applies the indenting and space formatting for the language as specified on the Formatting pane of the language in the Text Editor section of the Options dialog to the selected text.
Cuts all selected lines or the current line if nothing has been selected to the clipboard
Deletes all selected lines or the current line if no selection has been made
Inserts a blank line above the cursor
Inserts a blank line below the cursor
Moves the line containing the cursor below the next line
Lists members for statement completion when editing code
Changes the selected text to lowercase characters
Changes the selected text to uppercase characters
Displays a tooltip that contains information for the current parameter, based on the current language
Ctrl-M, Ctrl-U
Removes the outlining information for the currently selected region
Ctrl-M, Ctrl-P
Removes all outlining information from the entire document
Ctrl-R, Ctrl-P
Swaps the anchor and endpoint of the current selection
Ctrl-M, Ctrl-L
Toggles all previously marked hidden text sections between hidden and display states
Ctrl-K, Ctrl-K
Sets or removes a bookmark at the current line
Ctrl-M, Ctrl-M
Toggles the currently selected hidden text section or the section containing the cursor if there is no selection between the hidden and display states
Ctrl-K, Ctrl-H
Sets or removes a shortcut in the tasklist to the current line
Ctrl-R, Ctrl-R
Enables or disables word wrap in an editor
Ctrl-R, Ctrl-W
Shows or hides spaces and tab marks
Deletes the word to the right of the cursor
Deletes the word to the left of the cursor
Transposes the two words that follow the cursor. (For example, |End Sub would be changed to read Sub End|.)
Text Navigation Shortcut Keys
Moves the cursor to the end of the document
Moves the cursor to the start of the document
Displays the Go to Line dialog. If the debugger is running, the dialog also lets you specify addresses or function names to go to
Moves the cursor to the matching brace in the document. If the cursor is on an opening brace, this will move to the corresponding closing brace and vice versa
Ctrl-K, Ctrl-N
Moves to the next bookmark in the document
Ctrl-K, Ctrl-P
Moves to the previous bookmark
Ctrl-K, Ctrl-I
Displays Quick Info, based on the current language
Ctrl-Down Arrow
Scrolls text down one line but does not move the cursor. This is useful for scrolling more text into view without losing your place. Available only in text editors
Ctrl-Up Arrow
Scrolls text up one line but does not move the cursor. Available only in text editors
Ctrl-Right Arrow
Moves the cursor one word to the right
Ctrl-Left Arrow
Moves the cursor one word to the left
Navigates to the next definition, declaration, or reference of an item. Available in the object browser and Class View window. Also available in source editing windows if you have already used the Edit.GoToReference (Shift-F12) shortcut
Navigates to the previous definition, declaration, or reference of an item
General Shortcut Keys
Ctrl-X or Shift-Delete or Ctrl-L
Cuts the currently selected item to the clipboard
Delete next "word"
Ctrl-C or Ctrl-Insert
Copies the currently selected item to the clipboard
Ctrl-V or Shift-Insert
Pastes the item from the clipboard at the cursor location
Ctrl-Z or Alt-Backspace
Undo the previous editing action
To see intelligence dialog
Ctrl-Y or Ctrl-Shift-Z
Redo the previous undo action
Saves the current selected file
Saves all files and projects
Displays the Print dialog
Switches from the design view to the code view in the editor
Switches from the code view to the design view in the editor
Shift-F8 or F8
Navigate to compile time errors
Add Existing Item(file) to selected project
Add New Item(file) to selected project
Display the selected item quick output means contains value while debugging
Moves the cursor to the selected method, variable, class definition.
Finds the reference to the selected method, variable, class or the item under the cursor
Match curly braces, brackets or compiler directives
Select text between matched braces, brackets or compiler directives

jquery DataTable PlugIn in ASP.Net using C# or jQuery DataTables and ASP.NET Integration for GridView
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GridTable.aspx.cs"  
Inherits="DT_Pagination.GridTable" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
""> <html xmlns=""> <head runat="server">     <title></title>     <%--<link href="media_ColVis/css/ColVisAlt.css" rel="stylesheet" type="text/css" />-%>     <link href="media_ColVis/css/ColVis.css" rel="stylesheet" type="text/css" />     <link href="media/css/TableTools.css" rel="stylesheet" type="text/css" />     <link href="media/css/TableTools_JUI.css" rel="stylesheet" type="text/css" />     <link href="Scripts/css/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />     <link href="Scripts/css/themes/smoothness/jquery.ui.theme.css" rel="stylesheet" type="text/css" />          <link href="Scripts/css/jquery.dataTables_themeroller.css" rel="stylesheet" type="text/css" />     <script src="Scripts/js/jquery.js" type="text/javascript"></script>     <script src="Scripts/js/jquery.dataTables.min.js" type="text/javascript"></script>     <script src="media/js/ZeroClipboard.js" type="text/javascript"></script>     <%-<script src="media/js/TableTools.min.js" type="text/javascript"></script>-%>     <script src="media/js/TableTools.js" type="text/javascript"></script>     <script src="Scripts/js/jquery.dataTables.columnFilter.js" type="text/javascript"></script>     <script src="Scripts/js/jquery-ui-1.9.2.custom.min.js" type="text/javascript"></script>     <script src="Scripts/js/FixedHeader.js" type="text/javascript"></script>     <script src="media_ColVis/js/ColVis.js" type="text/javascript"></script>     <style type="text/css">         .ui-datepicker-calendar tr, .ui-datepicker-calendar td, .ui-datepicker-calendar td a, .ui-datepicker-calendar th         {             font-size: inherit;         }         div.ui-datepicker         {             font-size: 10px;         }         .ui-datepicker-title span         {             font-size: 10px;         }                  .my-style-class input[type=text]         {             color: green;         }     </style>     <script type="text/javascript">         var oTable;         $(document).ready(function () {             $.datepicker.regional[""].dateFormat = 'dd/mm/yy';             $.datepicker.setDefaults($.datepicker.regional['']);             TableTools.DEFAULTS.aButtons = [ "copy", "csv", "xls", "pdf", "print", { "sExtends": "collection", "sButtonText": "Save", "aButtons": [                                                 "csv",                                                 "xls", //"pdf",                                                 {                                                 "sExtends": "pdf",                                                 //"sPdfOrientation": "landscape",                                                 "sPdfMessage": "Your custom message would go here."                                              },                                  "print"                                             ] }]             //TableTools.DEFAULTS.aButtons = [ "copy", "csv", "xls",  "pdf" ];             /          Main Functionality       /             $('#GridView1').dataTable({                 //"oLanguage": { "sSearch": "Search the nominees:" },                 "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],                 "iDisplayLength": 10,                 "aaSorting": [[0, "asc"]],                 "bJQueryUI": true,                 "bAutoWidth": false,                 "bProcessing": true,                 "sDom": '<"top"i><"title">lt<"bottom"pf>',                 "sPaginationType": "full_numbers",                 "bRetrieve": true,                 //Scrolling--------------                 "sScrollY": "250px",                 "sScrollX": "100%",                                 "sScrollXInner": "100%",                 "bScrollCollapse": true,                 // ---  Print_Export_Copy  --                                 "sDom": 'T<"clear"><"H"lfr>t<"F"ip>',                 //"sDom": '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',                                             // --- Column Visiblity ----                                 //"sDom": '<"H"Cfr>t<"F"ip>',                 //                "oColVis": //                { //                    //"sDom": 'C<"clear">lfrtip', //                    "activate": "mouseover"                     //             //"bJQueryUI": true //                },                 //- Dynamic Language---------                 "oLanguage": {                     "sZeroRecords": "There are no Records that match your search critera",                     "sLengthMenu": "Display _MENU_ records per page&nbsp;&nbsp;",                     "sInfo": "Displaying _START_ to _END_ of _TOTAL_ records",                     "sInfoEmpty": "Showing 0 to 0 of 0 records",                     "sInfoFiltered": "(filtered from _MAX_ total records)",                     "sEmptyTable": 'No Rows to Display.....!',                     "sSearch": "Search all columns:"                 },                 / Column Sorting And Searching /                 //      "aoColumns": [                 // { "bSearchable": false }, //Disable search on this column 1                 // {"bSortable": false }, //Disable sorting on this column 2                                // {"asSorting": ["asc"] }, //Allow only "asc" sorting on column 2                 // null,                 // { "sSortDataType": "dom-text", "sType": "numeric" },                 // { "iDataSort": 4 }, //Use column 4 to perform sorting                 // null,                 // null                 // ],                 /  Column Visibilities /                 // "aoColumns": [                 // / Sno /{"bSearchable": false, "bVisible": false},                 // / Engine /   null,                 // / Browser /  null,                 // / Platform / { "bSearchable": false, "bVisible":    false },                 // / Version /  { "bSearchable": false, "bVisible":    false },                 // / Grade /     null,                 //      / Share /    null,                 //      / Date /    null                 // ],                 "oSearch": {                     "sSearch": "",                     "bRegex": false,                     "bSmart": true                 },                 //------------------------Total in footer                                 "fnFooterCallback": function TotalCalc(nRow, aaData, iStart, iEnd, aiDisplay) {                     / Calculate the total market share for all browsers in this table (ie inc. outside the pagination) /                     var iTotalMarket = 0;                     for (var i = 0; i < aaData.length; i++) {                         //alert('Length : ' + aaData.length + ', Row No : ' + i + ', Share : ' + aaData[i][6]);                         iTotalMarket += parseInt(aaData[i][6]);                     }                     / Calculate the market share for browsers on this page /                     var iPageMarket = 0;                     for (var i = iStart; i < iEnd; i++) {                         iPageMarket += parseInt(aaData[aiDisplay[i]][6]);                         //alert('Length : ' + iStart + ', Row No : ' + i + ', Share : ' + aaData[aiDisplay[i]][6] + 'Total : ' + iPageMarket);                     }                     / Modify the footer row to match what we want /                     var nCells = nRow.getElementsByTagName('td');                     nCells[0].innerHTML = 'Total : '+parseInt(iPageMarket * 100) / 100 + '% (' + parseInt(iTotalMarket * 100) / 100 + '% Grand Total)';                 } // End of Footer Footer             });             // ----- Header Buttons ---------             $('<a id="btnDelete" style="padding: 0px; display:none;" class="ui-button ui-widget ui-state-default ui-corner-all'             + 'ui-button-text-only" href="javascript:void(0)"><span style="font-size: small; padding: 2px 5px;"'             + 'class="ui-button-text"> Delete selected Row</span></a>&nbsp;&nbsp;<button id="refresh">Refresh</button>').appendTo('div.dataTables_length');             //$('<button id="refresh">Refresh</button>').appendTo('div.dataTables_length'); //ReFresh Button             $("table#GridView1").dataTable().columnFilter(                 {                     //sPlaceHolder: "foot:before",                     "aoColumns": [                                     null, //{ "type": "number-range" },                                     {"type": "text", width: "50px" },                                     { "type": "select" },                                     { "type": "text" }, //null, //{ "type": "date-range", width: "50px" },                                     {"type": "number-range", width: "50px" },                                     { "type": "select" },                                     { "type": "select" },                                     { "type": "date-range"}   //{ "type": "date-range", width: "50px" },                                     ]                 });             // -----------  Fixed Header   ----------- //            oTable = $('#GridView1').dataTable(); //            new FixedHeader(oTable);             //$('#GridView1 div.title').text("This is a table title");             / Add a click handler to the rows - this could be used as a callback /             $("#GridView1 tbody tr").click(function (e) {                 if ($(this).hasClass('row_selected')) {                     $(this).removeClass('row_selected');                     $('#btnDelete').hide();                 }                 else {                     oTable.$('tr.row_selected').removeClass('row_selected');                     $(this).addClass('row_selected');                     $('#btnDelete').show();                 }             });             / Add a click handler for the delete row /             $('#btnDelete').click(function () {                 var anSelected = fnGetSelected(oTable);                 if (anSelected.length !== 0) {                     / Nedd Ajax Call To perform in serverSide/                     if (confirm('Are you sure you wish to delete this row?')) {                         / do the delete /                         oTable.fnDeleteRow(anSelected[0]);                     }                     else {                         $("#GridView1 tbody tr").removeClass('row_selected');                         $('#btnDelete').hide();                     }                 }             });             $.fn.dataTableExt.oStdClasses["filterColumn"] = "my-style-class";             $('#GridView1 tbody td').click(function () {                 / Get the position of the current data from the node /                 var aPos = oTable.fnGetPosition(this);                 var aData = oTable.fnGetData(aPos[0]);                 //alert(aData[0]);             });             / Init the table /             oTable = $('#GridView1').dataTable();         });         function fnGetSelected(oTableLocal) {             return oTableLocal.$('tr.row_selected');         }         //$("").html('Organize by: <select id="booking_status"><option value="">All Bookings</option><option value="confirmed">Upcoming</option><option value="arrived">Arrived</option><option value="rejected">Rejected</option></select>');     </script>      </head> <body>     <form id="form1" runat="server">      <div class="Shadow">         <asp:GridView ID="GridView1" runat="server" OnPreRender="GridView1_PreRender" 
ShowFooter="true" AutoGenerateColumns="false">             <Columns>                                 <asp:TemplateField HeaderText="S.No">                     <ItemTemplate>                         <%# Eval("id") %>                     </ItemTemplate>                 </asp:TemplateField>                                 <asp:TemplateField HeaderText="Engine">                     <ItemTemplate>                         <%# Eval("engine")%>                     </ItemTemplate>                 </asp:TemplateField>                                 <asp:TemplateField HeaderText="Browser">                     <ItemTemplate>                         <%# Eval("browser")%>                     </ItemTemplate>                 </asp:TemplateField>                                 <asp:TemplateField HeaderText="Platform">                     <ItemTemplate>                         <%# Eval("platform")%>                     </ItemTemplate>                 </asp:TemplateField>                                 <asp:TemplateField HeaderText="Version">                     <ItemTemplate>                         <%# Eval("version")%>                     </ItemTemplate>                 </asp:TemplateField>                                 <asp:TemplateField HeaderText="Grade">                     <ItemTemplate>                         <%# Eval("grade")%>                     </ItemTemplate>                 </asp:TemplateField>                                 <asp:TemplateField HeaderText="Market Share">                     <ItemTemplate>                         <%# Eval("marketshare")%>                     </ItemTemplate>                 </asp:TemplateField>                                 <asp:TemplateField HeaderText="Date">                     <ItemTemplate>                         <%# Eval("RDate")%>                     </ItemTemplate>                                    </asp:TemplateField>             </Columns>         </asp:GridView>     </div>     </form> </body> </html>

Code Behind :

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; namespace DT_Pagination {     public partial class GridTable : System.Web.UI.Page     {         protected void Page_Load(object sender, EventArgs e)         { string strConnect = "server=.\\MYDATABASE; user id=sa; pwd=***; database=aspdotnetDB;";             DataSet dataset = new DataSet(); SqlDataAdapter da = new SqlDataAdapter("select *,convert(varchar(10),released,103) as RDate from ajax", strConnect);             da.Fill(dataset, "ajax");             GridView1.DataSource = dataset;             GridView1.DataBind();         }         protected void GridView1_PreRender(object sender, EventArgs e)         {             GridView1.UseAccessibleHeader = false;             GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;             GridView1.FooterRow.TableSection = TableRowSection.TableFooter;             int CellCount = GridView1.FooterRow.Cells.Count;             GridView1.FooterRow.Cells.Clear();             GridView1.FooterRow.Cells.Add(new TableCell());             GridView1.FooterRow.Cells[0].ColumnSpan = CellCount - 1;             GridView1.FooterRow.Cells[0].HorizontalAlign = HorizontalAlign.Right;             GridView1.FooterRow.Cells.Add(new TableCell());             TableFooterRow tfr = new TableFooterRow();             for (int i = 0; i < CellCount; i++)             {                 tfr.Cells.Add(new TableCell());                 //tfr.Cells[i].i                 //tfr.Cells[i].ColumnSpan = CellCount;                 //tfr.Cells[0].Text = "Footer 2";             }             GridView1.FooterRow.Controls[1].Controls.Add(tfr);         }     } }

Post has attachment
Sunday, December 16, 2012
How solve Unexpected Logout issues
When you set the Session TimeOut to 20, you would expect the Session to expire after 20 minutes of inactivity. However, you're using Session State Mode InProc (the default value), which means that the SessionState is stored in memory. When the Application Pool recycles. all Sessions stored in Memory will be lost. There can be many reasons why the Application Pool recycles.

Also, in a shared hosted environment, Application Pools recycles frequently. To overcome both problems, you should consider to use another SessionState Mode:

But this has nothing to do with authentication, as already stated! When you set the forms authentication to 20 minutes, it means that the user will be logged out anywhere between 10 to 20 minutes of inactivity. This is because the authentication ticket is only reset after more than half of the timeout has expired.

But sometimes the authentication ticket seems to expire unexpectedly also, forcing the user to the login page.. To understand why this happens, you need to understand how authentication works.

When you login, an authentication ticket is created in a cookie. By default, this authentication ticket encrypted using the machinekey section in web.config. When this section is not specified in web.config, ASP.NET will generate one for you. If the application pool recycles, sometimes ASP.NET will generate a new machinekey (although MSDN says different!) especially in shared hosted environment. But with this new key, the authentication ticket cannot be decrypted anymore, so the user is redirected to the login page. To overcome this, simply add a machinekey section in your web.config, so the same key is used on each and every request:
Wait while more posts are being loaded