Skip to main content

The ASP.NET Event Model with Post Back feature

ASP.NET providing fully organized event divan code model for its users and In this model you can add control to web form and then can decided what event need to trigger. Each event handler is a discrete mechanism which keeps the page tidy and organized. Lets we looks around how ASP.NET code model work

  1. When our page run first time it will create page and control object, the initialize code execute, and then page is render to HTML and send it to client side.
  2. After reach web page to client side, page get the users feed backs like click submit button then reach to ASP.NET server side back
  3. In the side of sever now compare the page with the state which it had before send to the client.
  4. After understanding the difference it will trigger some action in the side of server like DB update operation
  5. Finally modify the page and render the html code and send it to client side. This same process will continue from step to over and over again according to the client reaction.

Actually this is seems to be a straightforward process.

This event model comes to handy with post back feature of ASP.NET. Because it will proved lot of convenience to developer for make life easy. With this feature, input controls can fire different events, and your server-side code can respond immediately. For example, you can trigger a postback when the user clicks a check box, changes the selection in a list, or changes the text in a text box and then moves to another field. These events still aren’t as fine-grained as events in a Windows application, but they are a significant step up from the submit button.

In the every time page post back to the server and server will retrieve all the information such as input field values, user selected item or check box values and more. Then after page load into its original state according to the .aspx file to resend this file to client. Some time client collect full of dynamic data other than couple of input field values. In the common sense to save this collected data we have to use session or define cookies like in PHP. But in the ASP.NET developer life make easier some awful techniques of post back mechanism. In this method before page send to the client ASP.NET examine whole web page and properties and make a not about changers form its original state. If there is any change that changers serialize into 64bit characters and send it for client side as hidden field. This view state (client side view) may face to trouble when this hidden data comes to lager and lager. In this case we can disable view state for a control by setting its EnableViewState property to false. But in this case we have to reinitialize data in every post back.

Fallowing code example show the simple view sate with hidden field



This view state hidden field values are not human readable. Therefore we can convert those into human readable format as fallow.


Comments

Popular posts from this blog

How to extract vtiger DB data

Here is the code sample how extract data form vtiger DB with WHERE close. Sample:1 require_once('include/DatabaseUtil.php'); global $adb; $tabid = array('9','16'); $sql = "SELECT tabid, fieldname, fieldid, fieldlabel,columnname, tablename, uitype, typeofdata, presence FROM vtiger_field WHERE tabid in (" . generateQuestionMarks($tabid) . ")"; $result = $adb->pquery($sql, array($tabid)); // get result $noofrows = $adb->num_rows($result); // get number of rows $i=0; $data=array(); while($resultrow = $adb->fetch_array($result)) { $tabid=$resultrow['tabid']; $resultrow=['fieldlabel']; $data[$i]=array($tabid, $resultrow); } Sample:2 require_once('include/DatabaseUtil.php'); global $adb; $query = 'select idlists,from_email,to_email,cc_email,bcc_email from vtiger_emaildetails where emailid =?'; $result = $adb->pquery($query, array($focus->id)); $from_email = $adb->query_result($result,0,'from_...

Debugging PHP with Netbeans

Most of the PHP developers are complaining that they have not a good ID for PHP debugging and every time that they have to use var_dump() print statement or PHP die or exit commands to check the state of php script. But now we can use netbeans to overcome this issue with netbeans-xdebug. I tried this with Linux and feel that working it cool. Anyway still I had not a time to try out this with windows and hope that netbeans-xdebuger working fine with windows also. Now I am going to explain how we can enable netbeans-xdebuger in Ubuntu 1. First we should have a netbeans installation package (Download from here ) 2. After installing Netbeans we can install xdebuger. To do that open terminal and type fallowing commands. sudo apt-get install php5-dev php-pear sudo pecl install xdebug 3. Now you have installed xdebug successfully but not configure with PHP yet. To Configure xdebuger with php and netbeans ID. open php.ini file using this command; sudo gedit /etc/php5/apache2/php.ini A...

Unix VS Linux

Free Software says that people have freedom to share software and related technology free without any hesitating. And also this may enable the rapid software development because all brains become to one stage and play the game. On a technical level, Free software grantees the right view and also modify source code if some one need different think as his view. In this post I am not going to deeply discuss about what Unix is and What Linux but here lats we talk about some interesting happenings around Unix and Linux What is Unix. In 1980, A computer scientist called Richard Stallman decided to create a venerable operating system called Unix. At the time Unix ran many of industrial and academic system in the world. He started developing Unix operating system and most of the world wide people join with him to success this operating system. Stallman called his version as "GNU" (Pronounced G-noo). This was start of GNU but not Unix, any way this was the new legendary of Unix so th...