Posts
Showing posts from 2010
Setting localized tooltips in a sort enabled radgrid
- Get link
- X
- Other Apps
Problem statements 1. End user needs tooltips - even on the grid headers. (Not sure of scenario where user will move mouse over the grid headers, but our end users demanded for it). 2. Telerik grid normally has no problem with showing grid headers, but when showing sortable columns, it display linkbuttons for clicking and does not display the tooltip. 3. Although there is a custom way to display tooltips, we want tooltips from resource file (localized) and also do not want to hard code any string in the source code. We also want these tips to be localized. Following is what we did: protected void GridViewAccountDetails_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridHeaderItem) { GridColumnCollection gridColumnCollection = GridViewFindAudit.MasterTableView.Columns; GridHeaderItem gridHeaderItem = e.Item as GridHeaderItem; foreach (GridColumn column in gridColumnCollection) ...
Security with Server.Transfer
- Get link
- X
- Other Apps
Difference between Response.Redirect and Server.Transfer is a favorite (and common) interview question. One of the benefits of Server.Transfer is that round trip to the client browser is avoided. Recently, we were so much carried away by this advantage that we hit a security issue (and this is usually not mentioned in the interview questions listing sites :-)). We are using a custom http module for that takes care of Windows Live authentication + custom defined authorization and sends it to the asp if the user is defined as valid user for the page accessed. indexpage.aspx -> accessible to all specialpage.aspx - > accessible to only admins indexpage.aspx had a logic and redirect to specialpage.aspx on a special condition. Something went wrong in this checking and users who had no permission to specialPage.aspx were sent to it via Server.Transfer. And because we were using Server.Transfer, it directly got transferred without the httpmodule comong in between. Had we used Response.R...
Read full agreement and then say "I agree"
- Get link
- X
- Other Apps
Lot of sites show some licence text, make you accept it and only then you can proceed with the download/next pages. In order to make sure that you read these, some UI applications have a feature that the "I Agree" button is activated only when you have scrolled through the entire licence agreement. While this is easy to implement in WindowsUI, following a sample snippet how we implemented it in our web applications. <div style="HEIGHT: 150px; OVERFLOW: auto" onscroll="javascript:displayScroll(this);"> I Agree I cannot agree to this agreement.<br/>I Agree I cannot agree to this agreement.<br/> I Agree I cannot agree to this agreement.<br/>I Agree I cannot agree to this agreement.<br/> I Agree I cannot agree to this agreement.<br/>I Agree I cannot agree to this agreement.<br/> I Agree I cannot agree to this agreement.<br/>I Agree I cannot agree to this agreement.<br/> I Agree I cannot agree to this agreem...
Dirty workarouds: dirty page checking + AJAX
- Get link
- X
- Other Apps
Dirty page checking is scenario when you have a form, user does some modifications and before hitting the save button, tries to leave the page. Enterprise web applications have a requirement to intimate the user that "there are unsaved details" and "do you really want to move away from this page". The idea of solution behind this is 1. use of window.beforeunload and 2. use of onchange to register the window.beforeunload. As setting window.beforeunload manually for each control can be timeconsuming, we need a generic solution which will work with minimal code changes. If you search for this on internet, you will find the following generic code: <script type="text/javascript"> function setDirty() { window.onbeforeunload = showNavigateAwayMessage; } function clearDirty() { window.onbeforeunload = ""; } function showNavigateAwayMessage() { return "There is some unsaved Data in this form." } function setControlChangeEvent() { if (typeo...
Combination of onblur event and .focus() can cause recusion errors
- Get link
- X
- Other Apps
We had a strange and irritating recusrsive popup problem in our web application during our last release. User scenario: We have a grid with a text box in each row for tax value. On page load, this is populated with default tax values: User can edit the tax amount in each textbox. Now, the requirement is that the user should not be able to set all the textboxes to zero. Further, when the user tries to do that, a message should be shown and the focus should go back to this textbox whose value was being set to zero. How we were doing this We were using onBlur event of textbox, check if all text boxes set to zero and set the focus back if yes. ..... checkAllTextsBlank(movedAwayFrom) { var allTextboxesZero = areAllTextboxesZero(); if(allTextboxesZero) { alert("You cannot set all taxes to zero"); movedAwayFrom.focus(); } Where areAllTextboxesZero used to iterate through each textbox and see if all have zero value. Problem in this approach Consider this scenario: We set the first te...