<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2483677904723314337</id><updated>2011-12-16T11:51:44.849+05:30</updated><category term='Page Life Cycle'/><category term='change the style of DataGrid columns'/><category term='DataGrid'/><category term='ASP.NET Page Life Cycle'/><category term='DataGridColumnTemplate'/><category term='CSS'/><category term='Style'/><category term='ASP.NET Page'/><title type='text'>Random Thoughts of Priyan Perera</title><subtitle type='html'>Software Engineering, C#.NET, ASP.NET and Free Software</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://priyanperera.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2483677904723314337/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://priyanperera.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Priyan Perera</name><uri>http://www.blogger.com/profile/06822774099048762751</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://4.bp.blogspot.com/_ssUuSfygYe4/StcFWkcg9SI/AAAAAAAAABY/uKEB0ta1vt0/S220/priyan+-+Copy.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2483677904723314337.post-3779996222674451922</id><published>2011-12-15T14:08:00.003+05:30</published><updated>2011-12-15T14:12:18.862+05:30</updated><title type='text'>How to fix, Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Problem&lt;/span&gt;:&lt;br /&gt;You have a text box in the page with the potential to insert text with HTML tags. When I inserted some text with tags and clicked a submit button to invoke the post back I got the script error.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In my scenario, I was using ASP.NET 4.0 with Telerik RadAjaxPanel. The first suggestion I found when googling was to turn request validation off. But it did not fix my problem. So to find out the issue, I removed the RadAjaxPanel from the code. That is when I got the next error.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;A potentially dangerous Request.Form value was detected from the client&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;When I googled this issue I found that apart from setting the request validation, if we are using ASP.NET 4.0 we further need to set the httpRuntime attribute requestValidationMode  to 2.0.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Reason&lt;/b&gt;:&lt;br /&gt;ASP.NET automatically validates incoming HTTP requests to prevent script-injection attacks. It prevents the server from accepting and storing content with un-encoded HTML. However, the developer has the ability to turn this feature off. When request validation is turned off, it is strongly recommended that input data is validated and HTML encode when necessary.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Solution&lt;/b&gt;:&lt;br /&gt;To turn off request validation for a page, set ValidateRequest page attribute to false.&lt;br /&gt;ValidateRequest="false"&lt;br /&gt;&lt;br /&gt;To turn off request validation for the whole application, set the pages elements validateRequest attribute in the web.config to false.&lt;br /&gt;&lt;pages validaterequest="false"&gt;&lt;/pages&gt;&lt;br /&gt;If you are using ASP.NET 4.0, then set the httpRuntime attribute requestValidationMode to 2.0.&lt;br /&gt;&lt;httpruntime maxrequestlength="1048576" executiontimeout="3600" requestvalidationmode="2.0"&gt;&lt;br /&gt;&lt;b&gt;References&lt;/b&gt;:&lt;br /&gt;A potentially dangerous Request.Form value was detected from the client&lt;br /&gt;&lt;a href="http://www.cryer.co.uk/brian/mswinswdev/ms_vbnet_server_error_potentially_dangerous.htm"&gt;http://www.cryer.co.uk/brian/mswinswdev/ms_vbnet_server_error_potentially_dangerous.htm&lt;/a&gt;&lt;/httpruntime&gt;&lt;div&gt;&lt;httpruntime maxrequestlength="1048576" executiontimeout="3600" requestvalidationmode="2.0"&gt;ASP.NET Request Validation&lt;br /&gt;&lt;a href="http://www.asp.net/whitepapers/request-validation"&gt;http://www.asp.net/whitepapers/request-validation&lt;/a&gt;&lt;/httpruntime&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2483677904723314337-3779996222674451922?l=priyanperera.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://priyanperera.blogspot.com/feeds/3779996222674451922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://priyanperera.blogspot.com/2011/12/how-to-fix-syswebformspagerequestmanage.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2483677904723314337/posts/default/3779996222674451922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2483677904723314337/posts/default/3779996222674451922'/><link rel='alternate' type='text/html' href='http://priyanperera.blogspot.com/2011/12/how-to-fix-syswebformspagerequestmanage.html' title='How to fix, Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code'/><author><name>Priyan Perera</name><uri>http://www.blogger.com/profile/06822774099048762751</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://4.bp.blogspot.com/_ssUuSfygYe4/StcFWkcg9SI/AAAAAAAAABY/uKEB0ta1vt0/S220/priyan+-+Copy.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2483677904723314337.post-724450968759252199</id><published>2010-02-13T17:14:00.003+05:30</published><updated>2010-02-13T17:29:26.279+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Page Life Cycle'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET Page Life Cycle'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET Page'/><title type='text'>ASP.NET Page Life Cycle</title><content type='html'>&lt;span style=";font-family:verdana;font-size:85%;"  &gt;This is an extract from the page life cycle video available at the asp.net site. You can download the video from the &lt;a href="http://http//www.asp.net/learn/videos/video-6558.aspx"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PreInit&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We can determine if the request is a post back or an initial rendering early in the life cycle by accessing the IsPostBack property in the PreInit event. If the request is a post back, the values of the controls are still not reconstituted from the view state of the control. We can use this event to set global properties of the page.&lt;br /&gt;Ex: Dynamically set a master page or theme, set profile properties using ASP.NET profile system, create or recreate dynamically created controls (controls that are not added during the design time).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Init&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Fired after all the controls on the page have been initialized and any skin settings are applied to those controls. We can use this event to read or write any specific control properties.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;InitComplete&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since this event is fired after all the controls on the page are initialized we can use this event to perform tasks that depend on the page and controls to be initialized.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PreLoad&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Preload event can be used to do any processing that needs to be before the page and the controls get loaded. After the page preload event all the preload events for the controls on the page are fired. Thereafter all the ViewState data gets initialized followed by postback data from the request object.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Load&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After the page load event handler gets called, recursively Unload events for all the controls on the page are called as each control is loaded. After the Load and Unload event handlers are called for all the controls in the page, all the other configured event handlers for the controls are called.&lt;br /&gt;Ex: Click event handlers for buttons, TextChanged event handlers for text boxes, Validation controls events&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;LoadComplete&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We can use the LoadComplete event to perform tasks that require all the controls in the page to be loaded and validated.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PreRender&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this point in time all the controls are created in memory and we need to render those controls, so that the markup can be sent to the browser. Before the PreRender event gets fired, the page object calls to ensure that every child object in the page has its PreRender event called, every data bound control that has a DataSourceID property set has its DataBind method called. We can use the PreRender event to make final changes to the content of the page or the controls of the page before it is turned into html for sending to the browser.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SaveSateComplete&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Before this event is fired, ViewState for the entire page and its controls are saved. So any changes done to the state of the page and the controls on the page will not be saved and rendered on the browser. We can use this event to perform any logic against the ViewState but not any modifications. Now the page is ready to be rendered.&lt;br /&gt;&lt;br /&gt;There is no Render event but the page object will call all the Render methods of all the controls on the page which will render all the types of controls (built-in controls, user controls, custom controls etc.).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Unload&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When Page_Unload event is fired, we cannot do anything with the page because the page is already rendered. If we try to access any page elements during this event, exceptions will be thrown.&lt;br /&gt;Ex: We cannot access the Response object&lt;br /&gt;&lt;br /&gt;Unload events will be fired for both the page and each individual control on the page. We can use the Unload event to do final cleanup tasks like closing database connections, closing opened files etc.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2483677904723314337-724450968759252199?l=priyanperera.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://priyanperera.blogspot.com/feeds/724450968759252199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://priyanperera.blogspot.com/2010/02/aspnet-page-life-cycle.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2483677904723314337/posts/default/724450968759252199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2483677904723314337/posts/default/724450968759252199'/><link rel='alternate' type='text/html' href='http://priyanperera.blogspot.com/2010/02/aspnet-page-life-cycle.html' title='ASP.NET Page Life Cycle'/><author><name>Priyan Perera</name><uri>http://www.blogger.com/profile/06822774099048762751</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://4.bp.blogspot.com/_ssUuSfygYe4/StcFWkcg9SI/AAAAAAAAABY/uKEB0ta1vt0/S220/priyan+-+Copy.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2483677904723314337.post-2089894894914298465</id><published>2009-04-14T20:35:00.001+05:30</published><updated>2010-02-13T17:24:54.548+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='DataGridColumnTemplate'/><category scheme='http://www.blogger.com/atom/ns#' term='DataGrid'/><category scheme='http://www.blogger.com/atom/ns#' term='Style'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><category scheme='http://www.blogger.com/atom/ns#' term='change the style of DataGrid columns'/><title type='text'>How to change the style of DataGrid columns during the runtime (Apply styles to DataGrid columns at runtime)</title><content type='html'>&lt;span style="font-family: verdana;font-size:85%;" &gt;Recently I was asked to do a task where it needed to change the style of a DataGrid column item during the runtime. I tried in various ways and finally came up with the solution listed below. The requirement was to change the applied style of a DataGridColumnTemplate and apply a new style. We are using the Telerik RadGrid in our development but I am quite sure that this can be applied to the normal grid as well. The style needed to be applied to a LinkButton which was inside the DataGridColumnTemplate.&lt;br /&gt;&lt;br /&gt;I am using the ItemDataBound of the DataGrid control to apply the changes. First I am selecting the particular row to be edited. In this case, the row in which the style needs to be changed. In this example, I am first checking whether the item provided to the event is a GridDataItem. In this example, I am only changing the style of rows, which meets a specific criterion (I am checking whether a particular record is ‘&lt;span style="font-style: italic;"&gt;inactive&lt;/span&gt;’). Thereafter I am setting the style of the entire row to a new style (item.CssClass = "disabledrow";).&lt;br /&gt;&lt;br /&gt;Each DataGridColumnTemplate has a controls collection. We need to select the required control from the collection (if (control.ID == "imgSearchView")). Then cast the control to the required control and apply the style.&lt;br /&gt;&lt;br /&gt;           LinkButton linkButton = null;&lt;br /&gt;           if (e.Item is GridDataItem)&lt;br /&gt;           {&lt;br /&gt;               GridDataItem item = (GridDataItem)e.Item;&lt;br /&gt;               if (item["activecolumn"].Text.ToString() == EntityActiveStatus.Inactive.ToString())&lt;br /&gt;               {&lt;br /&gt;                   item.CssClass = "disabledrow";&lt;br /&gt;&lt;br /&gt;                   foreach (Control control in item["viewcolumn"].Controls)&lt;br /&gt;                   {&lt;br /&gt;                       if (control.ID == "imgSearchView")&lt;br /&gt;                       {&lt;br /&gt;                           linkButton = (LinkButton)control;&lt;br /&gt;                           linkButton.CssClass = "btnViewGray";&lt;br /&gt;                       }&lt;br /&gt;                   }&lt;br /&gt;&lt;br /&gt;                   foreach (Control control in item["editcolumn"].Controls)&lt;br /&gt;                   {&lt;br /&gt;                       if (control.ID == "imgSearchEdit")&lt;br /&gt;                       {&lt;br /&gt;                           linkButton = (LinkButton)control;&lt;br /&gt;                           linkButton.CssClass = "btnEditGray";&lt;br /&gt;                       }&lt;br /&gt;                   }&lt;br /&gt;&lt;br /&gt;                   foreach (Control control in item["deletecolumn"].Controls)&lt;br /&gt;                   {&lt;br /&gt;                       if (control.ID == "imgSearchDelete")&lt;br /&gt;                       {&lt;br /&gt;                           linkButton = (LinkButton)control;&lt;br /&gt;                           linkButton.CssClass = "btnDeactivateGray";&lt;br /&gt;                           linkButton.ToolTip = "Activate";&lt;br /&gt;                       }&lt;br /&gt;                   }&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;Please leave a comment or contact me at my email address if you have any concerns.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2483677904723314337-2089894894914298465?l=priyanperera.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://priyanperera.blogspot.com/feeds/2089894894914298465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://priyanperera.blogspot.com/2009/04/how-to-change-style-of-datagrid-columns.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2483677904723314337/posts/default/2089894894914298465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2483677904723314337/posts/default/2089894894914298465'/><link rel='alternate' type='text/html' href='http://priyanperera.blogspot.com/2009/04/how-to-change-style-of-datagrid-columns.html' title='How to change the style of DataGrid columns during the runtime (Apply styles to DataGrid columns at runtime)'/><author><name>Priyan Perera</name><uri>http://www.blogger.com/profile/06822774099048762751</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://4.bp.blogspot.com/_ssUuSfygYe4/StcFWkcg9SI/AAAAAAAAABY/uKEB0ta1vt0/S220/priyan+-+Copy.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2483677904723314337.post-3039333080144697147</id><published>2009-03-28T21:13:00.002+05:30</published><updated>2010-02-13T17:26:56.409+05:30</updated><title type='text'>MCAD...finally...</title><content type='html'>&lt;p  class="MsoNormal" style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;It is been a long time since I started my certifications. While I was able to complete three exams on the trot, I could not continue the same trend over time. It’s now close to a year since I started the certification. But I am really happy, that I was able to become an MCAD, even it more time than it should. Hopefully, I am thinking of going for MCSD, which as of now seems a really tough task with just three days left for the exam retirement date.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2483677904723314337-3039333080144697147?l=priyanperera.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://priyanperera.blogspot.com/feeds/3039333080144697147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://priyanperera.blogspot.com/2009/03/mcadfinally.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2483677904723314337/posts/default/3039333080144697147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2483677904723314337/posts/default/3039333080144697147'/><link rel='alternate' type='text/html' href='http://priyanperera.blogspot.com/2009/03/mcadfinally.html' title='MCAD...finally...'/><author><name>Priyan Perera</name><uri>http://www.blogger.com/profile/06822774099048762751</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://4.bp.blogspot.com/_ssUuSfygYe4/StcFWkcg9SI/AAAAAAAAABY/uKEB0ta1vt0/S220/priyan+-+Copy.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2483677904723314337.post-6345464847432066504</id><published>2009-03-28T21:09:00.002+05:30</published><updated>2010-02-13T17:27:51.187+05:30</updated><title type='text'>Thank God...I have finally started blogging...</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;I wanted to blog for long time. But I never really got started. Finally..today...I started...to blog. I think blogging will not only be fun...but will enable me to learn a lot of stuff...hopefully...I can continue what I started... :D&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2483677904723314337-6345464847432066504?l=priyanperera.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://priyanperera.blogspot.com/feeds/6345464847432066504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://priyanperera.blogspot.com/2009/03/thank-godi-jave-finally-started.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2483677904723314337/posts/default/6345464847432066504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2483677904723314337/posts/default/6345464847432066504'/><link rel='alternate' type='text/html' href='http://priyanperera.blogspot.com/2009/03/thank-godi-jave-finally-started.html' title='Thank God...I have finally started blogging...'/><author><name>Priyan Perera</name><uri>http://www.blogger.com/profile/06822774099048762751</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://4.bp.blogspot.com/_ssUuSfygYe4/StcFWkcg9SI/AAAAAAAAABY/uKEB0ta1vt0/S220/priyan+-+Copy.jpg'/></author><thr:total>0</thr:total></entry></feed>
