Category Archives: Localize

Localize

[RESOLVED]Multilanguage routing and language from a browser.

How can I add default culture to the RouteValueDictionary(): r.Defaults.Add("culture", "sv") in this code:

routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );

            foreach(var r in from Route r in routes where !(r.RouteHandler is SingleCultureRouteHandler) select r)
            {
                r.RouteHandler = new MultiCultureRouteHandler();
                
                r.Url = "{culture}/" + r.Url;

                // Adding default culture
                if(r.Defaults == null)
                {
                    r.Defaults = new RouteValueDictionary();
                }
                r.Defaults.Add("culture", "sv");

                // Adding constraint for culture param
                if(r.Constraints == null)
                {
                    r.Constraints = new RouteValueDictionary();
                }
                r.Constraints.Add("culture", new UserRouteConstraint("en", "sv"));
            }

This way: r.Defaults.Add("culture", HttpContext.Current.Request.UserLanguages[0].Substring(0, 2)) get this error message: "Request
is not available in this
context
".

Thanks in advance!

Zurx

can I add default culture to the RouteValueDictionary():

With a actionFilter. See http://haacked.com/archive/2010/02/21/manipulating-action-method-parameters.aspx/

Hi Zurx,

Thanks for your post.

The best thing to do is to add our localized route first and keep the default second. The way the routing works, it will use the first route that matches.

routes.MapRoute(
                name: "Localization",
                url: "{lang}/{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );

 You can  use an Attribute, making it easy to use. Under the Filter folder add a new class which inherits from ActionFilterAttribute. This method will check if "lang" is available from RouteData. If lang is present it will change the currentUICulture of
the current thread. If "lang" is not part of the URL, then it will set it to the default.

More information,you can refer to the following link:

#Localization from url with Asp.Net MVC 4

http://www.frankysnotes.com/2013/11/localization-from-url-with-aspnet-mvc-4.html

Hope this can be helpful.

Best Regards,

Eileen

Thank you! This is a great solution!

I wrote

public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var culture = filterContext.RouteData.Values["culture"] as string;
            var userLanguage = HttpContext.Current.Request.UserLanguages;
            
            CultureInfo cultureInfo = new CultureInfo(culture ?? (userLanguage != null ? userLanguage[0].Substring(0, 2) : "sv"));

            Thread.CurrentThread.CurrentUICulture = cultureInfo;
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cultureInfo.Name);
            base.OnActionExecuting(filterContext);
        }

[RESOLVED]What do these tags mean?

Hi folks, another newbie question!  Having inherited a website, i am noticing script tags <%#   and <%: as well as <%= (which i understand from the old days as Response.Write!)

What are the significance of these?

Thanks! Embarassed

<div>

<%@ %> is used for page level directives. (<%@ Control Inherits="MyParentControl" %>)
<% %> is for inclusion of server-side code to the Render() method (<% x = x + 1; %>) of the generated class
<%= %> is equivalent of Response.Write(); call in the Render() method
<%: %> is the same as previous, but the output is HTML encoded (see below)
<%# %> is used for data-binding expressions. The data-binding expressions can be used in attributes of server tags to assign calculated values to properties. Also they can be used like a separate tag. In this case a DataBoundLiteralControl
instance is automatically generated for the expression to assign a value to its Text property. These expressions are evaluated and assignments are executed when the DataBinding event is fired for the control that contains data-binding expression, because for
every such a control an event handler is generated of these expressions.
<%$ %> is used for custom expression binding. E.g. for localized string resources. Can only be used in attributes of server tags to assign calculated values to properties. These assignments are added to the OnInit() method of the generated
class. See http://msdn.microsoft.com/en-us/library/d5bd1tad.aspx
<%– –%> is used for server-side comments.


</div>

Taken From

chandrashekar

Hi

Refer the post below.

http://forums.asp.net/p/1139381/1828702.aspx

Thanks for that, always wondered why i could not search for them too :-)

These are called inline server tags for asp.net.

<%# %> - This is Databinding syntax
<%: %> and <%= %> - Rendering Code 

refer below link for more details

http://weblogs.asp.net/ahmedmoosa/archive/2010/10/06/embedded-code-and-inline-server-tags.aspx

Hi mmacneill123,

They are mostly called as "ASP.NET Inline Expressions in the .Net Framework"

The embedded code block is used to preserve backward compatibility with classical ASP. The code in the block can execute programming statements and call functions in the current page class during the page-rendering phase.

The <%= … %>displaying expression is an equivalent of the embedded code block that contains only the Response.Write(…) statement. This is the simplest way to display information such as a single string, an int variable, or a constant. 

The directive expression is the syntax that specifies settings that are used by the page and by user control compilers when they process ASP.NET Web Form (.aspx) pages and User Control (.ascx) files.

The data-binding expression creates binding between a server control property and a data source when the control’sDataBind method of this server control is called on the page. 

The expression builder is used to set values of control properties based on the information that is contained in an application’s configuration or resource files. 

The server-side comments block lets developers embed code comments in any location of the HTML source of ASP.NET Web Form pages (except for within <script> code blocks). Any content between the opening and closing tags of the server-side comments block
will not be processed on the server or rendered on the resulting page.

Hope this helps.

Thanks,

Jatin


[RESOLVED]What is the Best Way to Pass Client-Side Info to Other Pages (In Same Application)

I have some information that is obtained from the client (Date().getTimezoneOffset()) that I need to save from the application Home page and then make available to all the other pages in the application. The other pages use this information to localize dates
before they are displayed in reports.

What I am doing now is obtaining the information on the initial page load, passing as an argument for postBack and then on postBack saving that value in a Session variable in Page_Load. It works but it seems like a kludge…

I could also add it as a QueryString parameter to the page, this also seems prone to error — someone bookmarks a URL and then later runs the page from a different time zone…

I tried saving the information in a Hidden variable in an UpdatePanel but I was never able to get this to work.

Any thoughts or suggestions would be appreciated!

Session Variables work throughout the users session on every page. Session("Date") = Date().getTimezoneOffset() to set it and then check,

If Not IsNothing(Session("Date")) then

 ‘ user date

End if

You can also use cookies 

I thought Session was a server side component and that you could not set a Session variable from the Client. If I am wrong, how do you set a Session variable from the client?

You can use eaither hidden fields and pass them from page to page or use cookies.

Hi,

On pageload you can call a pagemethod in the background and set session variable-

http://delicious.com/anupdg/session+pagemethod

I guess I am not being clear — Once I get control back to the server I do not have any problem setting the Session variable. The problem I am having is getting the information from the client to the server without kluding a postback event.

In another application I force the user to click a button to do this, and it works. I was just looking for a cleaner solution.

If you want to have the information available on another page there WILL be a postback event (or should be) to redirect to that page. In the postback you can set the session variable. Now if you prefer you can set a cookie using javascript and use THAT http://www.w3schools.com/js/js_cookies.asp

MJEdelman

I guess I am not being clear — Once I get control back to the server I do not have any problem setting the Session variable. The problem I am having is getting the information f

If you use the approach I have shown you need not to do a postback or add a buttonclick.

asteranup

Hi,

On pageload you can call a pagemethod in the background and set session variable-

http://delicious.com/anupdg/session+pagemethod

asteranup

MJEdelman

I guess I am not being clear — Once I get control back to the server I do not have any problem setting the Session variable. The problem I am having is getting the information f

If you use the approach I have shoun you need not to do a postback or add a buttonclick.

I am not seeing the approach you referred to in your first message. When I click on the link it does not provide me a reference to something that I can map to what I am trying to do. I would appreciate it if you could be more specific with your solution.

Hi,

May be you have some network restriction. You can check the following fron the list I have given-

http://forums.asp.net/p/1708139/4544368.aspx/1?Re+Jquery+session

[RESOLVED]Localization in Javascript

I buy a third party calendar, that enable javascript navigation between month and years. I want to add localized calendar to it. in first load everything is good but when I change month, the calendar gets default state. How can I add Localization to javascript
codes?

Hi,

You may need to tweak! If you don’t know how do that, better ask the third party vendor to do it for u!

Hope it helps u…

Hello irani,

can you please let me know which third party tool you are using…..

A company in Iran. Pardazesh Vira Afzar.

I am not getting your reply.The calender your are using is which third party control???

A company in Iran. Pardazesh Vira Afzar.

i am not asking about localization place…

i am asking which company you buy third party calender(name of the third party control)

for example: ajax calender,Rad Calender,Telerik datetimepicker,component art calender etc,………….

Telerik datetimepicker and Rad Calender

Hello irani,

I hope this link may help to your requirement,please check it once.

http://yash-maneel.blogspot.in/2012/05/in-this-example-we-can-give-culture.html

This code only change month names. I want Calendar completely localized. I want to use persianCalendar instead of default calendar.

Hi,

try with  changing the browser default language setting.

Hello irani,

unfortunately Telerik controls dont support culture info for ""Persian"",u have one alternative is ""Persian (Iran)"" try this cultureinfo for your calender.Then also you need any furthur information means post your issue in telerik forums hope they may
give any solution for your problem.

[RESOLVED]looking for debug window

hello,

i cant find the window where you add a local variable and set stop condition for debug, ive a localized/translated version of the software and cant find out what is its name

thank you,

To set stop conditions for debug, you first need to create a breakpoint. Then right-click the breakpoint and click "Condition…" from the menu.

Once you are in debug mode:

to view local variables, from the menu click Debug > Windows > Locals

to add local variables, from the menu click Debug > Windows > Watch1

perfect, thank you.

No problem. Glad I could be of assistance.

[RESOLVED]Desing time error when loading a form

Hi. This might not be the place because the question involves a little WPF, but I’ll give it a shot:

I use a converter w/ spring to localize my text from a resource file. I have a class that uses this piece of code:

ContextRegistry.GetContext().GetMessage(value.ToString());

If I try to bind the Text property of any control to that Converter, it works fine at runtime (as all assemblies have been loaded), but the Page doesn’t show up at desing time, and I get this error:

No context registered. Use the ‘RegisterContext’ method or the ‘spring/context’ section from your configuration file.

An example of the markup would be this (here’s the WPF part):

<TextBlock Text="{Binding ., Converter={StaticResource LocalizacionConverter}, ConverterParameter=Titulo_Vista_Ejemplos}" />

What I think is happening is that Visual Studio is trying to execute my code at design time, and because of all the spring and stuff, it produces the error.

The specific question is: Is there a way, like a preprocessor directive or an attribute for my class, to tell Visual Studio not to run my code at design time?

Thanks a lot.

TATWORTH

You can get help about WPF at:

Yeah, I figured. But since I only got the error at design time, I thought it might be a Visual Studio issue. Thanks anyway.

[RESOLVED]Conditional compilation symbols?

 Hi ,

I would like to know what are Conditional compilation symbols and their use?

Thanks.

 

@C# Language Specification

2.5.1 Conditional compilation symbols

 

Hi,

from: http://msdn2.microsoft.com/en-us/library/x435tkbk.aspx

You can use conditional compilation to select particular sections of code to compile, while excluding other sections. For example, you may want to write debugging statements that compare the speed of different approaches to the same programming task,
or you may want to localize an application for multiple languages. Conditional compilation statements are designed to run during compile time, not at run time.

You declare a conditional compiler constant in code with the #Const directive, and you denote blocks of code to be conditionally compiled with the #If…Then…#Else directive. For example, to create French- and German-language versions of the same application
from the same source code, you embed platform-specific code segments in #If…Then statements using the predefined constants FrenchVersion and GermanVersion

At http://www.builderau.com.au/program/dotnet/soa/A-guide-to-conditional-compilation/0,339028399,339243600,00.htm you’ll also find
a tutorial on the subject.

Hi,

I have an additional question on this topic. What if I created a new active solution configuration called "WebHosting" at Configuration Manager, can I use #if WebHosting in my code?

In ASP.NET, I have tried to do conditional compilation, but I don’t have any luck. I hope you are not doing the same….

[RESOLVED]Menu is hided by other image?

Hi all,  i write maga menu with .dropdown_1columns css, but in IE browser the menu is hided by other image up-2.jpg (the css of up-2.jpg is below), in firefox is ok.

in IE:

 

in Firefox:

My code is below.

How can i fix css to solve this problem?

thank you in advanced, 

.dropdown_1columns {
	BORDER-BOTTOM: #777777 1px solid;
	POSITION:absolute;
	TEXT-ALIGN: left;
		
	BORDER-LEFT: #777777 1px solid;
	PADDING-BOTTOM: 10px;
	MARGIN: 4px auto auto auto;
	PADDING-LEFT: 5px;
	PADDING-RIGHT: 5px;
	BACKGROUND: #f4f4f4;
	FLOAT: left;
	BORDER-TOP: medium none;
	BORDER-RIGHT: #777777 1px solid;
	PADDING-TOP: 10px;
	LEFT: -999em;
			
	-moz-border-radius: 5px 5px 5px 5px;
	-webkit-border-radius: 5px 5px 5px 5px;
	border-radius: 5px 5px 5px 5px
	
	
}

 

.up-2sp
{
	background:url(images/up-2.jpg) no-repeat;
	background-position: bottom;
	height:20px;
	text-align:center;
	font-size:medium;
	vertical-align:middle;
	
	
				
}

 

 <li><a href='/IBSS_Web/sanpham/may-bo-vn.htm' id='megaanchor1' class='drop'>MVN</a>
<div  class="dropdown_1columns">
<div class="col_1">
<h3><b><a href='#'>IBM</a></b></h3>
<ul>
<li><a href='/IBSS_Web/sanpham/ibm-1.htm'>IBM 1</a></li>
</ul>
</div>
<div class="col_1">
<h3><b><a href='#'>HP</a></b></h3>
<ul>
<li><a href='/IBSS_Web/sanpham/hp-1.htm'>HP 1</a></li>
</ul>
</div>
<div class="col_1">
<h3><b><a href='#'>DEL</a></b></h3>
</div>
<br style='clear: left' />
</div>
 
</li>

 <tr>
                                            <td class="up-2sp">
                                                <strong class="style-l"><b>
                                                    
                                                    <asp:Localize runat="server" ID="locProductDirectory"  Text="San Pham"></asp:Localize>
                                                   </b> </strong><br />
                                            </td>
                                        </tr>

Hi,

Try debug using IE Developer Tools(F12), where you can adjust the CSS dynamically and check what’s going wrong in IE!

Hope it helps u…

Try giving a higher z-index for the menu and give z:index:-1 for the submenu

if i set z-index as below:

.up-2sp
{
	background:url(images/up-2.jpg) no-repeat;
	background-position: bottom;
	height:20px;
	text-align:center;
	font-size:medium;
	vertical-align:middle;
	z-index:-1; 
				
}
 
.dropdown_1columns {
	BORDER-BOTTOM: #777777 1px solid; 
	POSITION:absolute;
	TEXT-ALIGN: left;
	z-index:3000; 		
	BORDER-LEFT: #777777 1px solid; 
	PADDING-BOTTOM: 10px; 
	MARGIN: 4px auto auto auto; 
	PADDING-LEFT: 5px; 
	PADDING-RIGHT: 5px; 
	BACKGROUND: #f4f4f4; 
	FLOAT: left; 
	BORDER-TOP: medium none; 
	BORDER-RIGHT: #777777 1px solid; 
	PADDING-TOP: 10px; 
	LEFT: -999em;
			
	-moz-border-radius: 5px 5px 5px 5px; 
	-webkit-border-radius: 5px 5px 5px 5px; 
	border-radius: 5px 5px 5px 5px
	
	
}
 
The up-2.jpg is invisible In IE browser

 
In Firefox browser is visible (it is ok)
 

How to fix this problem with ie browser?

Hi,

Which version of IE are you using?

My browser is IE 8.

Hi,

Try with this - 

.up-2sp
{
        background:url(images/up-2.jpg) no-repeat;
        background-position: bottom;
        height:20px;
        text-align:center;
        font-size:medium;
        vertical-align:middle;
        z-index:3005;
                                
}

Hope it helps u…

Hello,

minhpg

.up-2sp
{
        background:url(images/up-2.jpg) no-repeat;
        background-position: bottom;
        height:20px;
        text-align:center;
        font-size:medium;
        vertical-align:middle;
        z-index:-1;
                                
}

Not -1. Just assign some lower z-index value than .dropdown_1columns class. Like below

.up-2sp
{
        background:url(images/up-2.jpg) no-repeat;
        background-position: bottom;
        height:20px;
        text-align:center;
        font-size:medium;
        vertical-align:middle;
        z-index:200;                   
}
.dropdown_1columns {
        BORDER-BOTTOM: #777777 1px solid; 
        POSITION:absolute;
        TEXT-ALIGN: left;
        z-index:3000;           
        BORDER-LEFT: #777777 1px solid; 
        PADDING-BOTTOM: 10px; 
        MARGIN: 4px auto auto auto; 
        PADDING-LEFT: 5px; 
        PADDING-RIGHT: 5px; 
        BACKGROUND: #f4f4f4; 
        FLOAT: left; 
        BORDER-TOP: medium none; 
        BORDER-RIGHT: #777777 1px solid; 
        PADDING-TOP: 10px; 
        LEFT: -999em;
                        
        -moz-border-radius: 5px 5px 5px 5px; 
        -webkit-border-radius: 5px 5px 5px 5px; 
        border-radius: 5px 5px 5px 5px;
}

if i set z-index for up-2sp class lower or higher value than
.
dropdown_1columns class, the problem is not solved.

in IE browser:

Any susgestion?

Hi,

Oops, i was bit confused with the stuff added by you!

Anyway, you should be having having higher Z-index, which you wish to show on top and lower Z-index, which you wish to show below!

Based on the criteria, just design it and try it out!

Hope it helps u…

i find out that because of using jquery corner with up-2sp class

$('.up-2sp').corner("top 10px");

how to fix jquery corner function listed below?

 

/*!
 * jQuery corner plugin: simple corner rounding
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.12 (23-MAY-2011)
 * Requires jQuery v1.3.2 or later
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Authors: Dave Methvin and Mike Alsup
 */

/**
 *  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
 *
 *  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
 *  corners: one or more of: top, bottom, tr, tl, br, or bl.  (default is all corners)
 *  width:   width of the effect; in the case of rounded corners this is the radius. 
 *           specify this value using the px suffix such as 10px (yes, it must be pixels).
 */
;(function($) { 

var style = document.createElement('div').style,
    moz = style['MozBorderRadius'] !== undefined,
    webkit = style['WebkitBorderRadius'] !== undefined,
    radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined,
    mode = document.documentMode || 0,
    noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8),

    expr = $.browser.msie && (function() {
        var div = document.createElement('div');
        try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
        catch(e) { return false; }
        return true;
    })();

$.support = $.support || {};
$.support.borderRadius = moz || webkit || radius; // so you can do:  if (!$.support.borderRadius) $('#myDiv').corner();

function sz(el, p) { 
    return parseInt($.css(el,p))||0; 
};
function hex2(s) {
    s = parseInt(s).toString(16);
    return ( s.length < 2 ) ? '0'+s : s;
};
function gpc(node) {
    while(node) {
        var v = $.css(node,'backgroundColor'), rgb;
        if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') {
            if (v.indexOf('rgb') >= 0) { 
                rgb = v.match(/d+/g); 
                return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
            }
            return v;
        }
        if (node.nodeName.toLowerCase() == 'html')
            break;
        node = node.parentNode; // keep walking if transparent
    }
    return '#ffffff';
};

function getWidth(fx, i, width) {
    switch(fx) {
    case 'round':  return Math.round(width*(1-Math.cos(Math.asin(i/width))));
    case 'cool':   return Math.round(width*(1+Math.cos(Math.asin(i/width))));
    case 'sharp':  return width-i;
    case 'bite':   return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
    case 'slide':  return Math.round(width*(Math.atan2(i,width/i)));
    case 'jut':    return Math.round(width*(Math.atan2(width,(width-i-1))));
    case 'curl':   return Math.round(width*(Math.atan(i)));
    case 'tear':   return Math.round(width*(Math.cos(i)));
    case 'wicked': return Math.round(width*(Math.tan(i)));
    case 'long':   return Math.round(width*(Math.sqrt(i)));
    case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
    case 'dogfold':
    case 'dog':    return (i&1) ? (i+1) : width;
    case 'dog2':   return (i&2) ? (i+1) : width;
    case 'dog3':   return (i&3) ? (i+1) : width;
    case 'fray':   return (i%2)*width;
    case 'notch':  return width; 
    case 'bevelfold':
    case 'bevel':  return i+1;
    case 'steep':  return i/2 + 1;
    case 'invsteep':return (width-i)/2+1;
    }
};

$.fn.corner = function(options) {
    // in 1.3+ we can fix mistakes with the ready state
    if (this.length == 0) {
        if (!$.isReady && this.selector) {
            var s = this.selector, c = this.context;
            $(function() {
                $(s,c).corner(options);
            });
        }
        return this;
    }

    return this.each(function(index){
        var $this = $(this),
            // meta values override options
            o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase(),
            keep = /keep/.test(o),                       // keep borders?
            cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]),  // corner color
            sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]),  // strip color
            width = parseInt((o.match(/(d+)px/)||[])[1]) || 10, // corner width
            re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog|invsteep|steep/,
            fx = ((o.match(re)||['round'])[0]),
            fold = /dogfold|bevelfold/.test(o),
            edges = { T:0, B:1 },
            opts = {
                TL:  /top|tl|left/.test(o),       TR:  /top|tr|right/.test(o),
                BL:  /bottom|bl|left/.test(o),    BR:  /bottom|br|right/.test(o)
            },
            // vars used in func later
            strip, pad, cssHeight, j, bot, d, ds, bw, i, w, e, c, common, $horz;
        
        if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
            opts = { TL:1, TR:1, BL:1, BR:1 };
            
        // support native rounding
        if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
            if (opts.TL)
                $this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
            if (opts.TR)
                $this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
            if (opts.BL)
                $this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
            if (opts.BR)
                $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
            return;
        }
            
        strip = document.createElement('div');
        $(strip).css({
            overflow: 'hidden',
            height: '1px',
            minHeight: '1px',
           
            fontSize: '1px',
            backgroundColor: sc || 'transparent',
            borderStyle: 'solid'
        });
    
        pad = {
            T: parseInt($.css(this,'paddingTop'))||0,     R: parseInt($.css(this,'paddingRight'))||0,
            B: parseInt($.css(this,'paddingBottom'))||0,  L: parseInt($.css(this,'paddingLeft'))||0
        };

        if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        cssHeight = $(this).outerHeight();

        for (j in edges) {
            bot = edges[j];
            // only add stips if needed
            if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
                strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
                d = document.createElement('div');
                $(d).addClass('jquery-corner');
                ds = d.style;

                bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

                if (bot && cssHeight != 'auto') {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.bottom = ds.left = ds.padding = ds.margin = '0';
                    if (expr)
                        ds.setExpression('width', 'this.parentNode.offsetWidth');
                    else
                        ds.width = '100%';
                }
                else if (!bot && $.browser.msie) {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
                    
                    // fix ie6 problem when blocked element has a border width
                    if (expr) {
                        bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
                        ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
                    }
                    else
                        ds.width = '100%';
                }
                else {
                    ds.position = 'relative';
                    ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : 
                                        (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';                
                }

                for (i=0; i < width; i++) {
                    w = Math.max(0,getWidth(fx,i, width));
                    e = strip.cloneNode(false);
                    e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
                    bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
                }
                
                if (fold && $.support.boxModel) {
                    if (bot && noBottomFold) continue;
                    for (c in opts) {
                        if (!opts[c]) continue;
                        if (bot && (c == 'TL' || c == 'TR')) continue;
                        if (!bot && (c == 'BL' || c == 'BR')) continue;
                        
                        common = { position: 'absolute',border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
                        $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
                        switch(c) {
                        case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
                        case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
                        case 'BL': $horz.css({ top: 0, left: 0 }); break;
                        case 'BR': $horz.css({ top: 0, right: 0 }); break;
                        }
                        d.appendChild($horz[0]);
                        
                        var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
                        switch(c) {
                        case 'TL': $vert.css({ left: width }); break;
                        case 'TR': $vert.css({ right: width }); break;
                        case 'BL': $vert.css({ left: width }); break;
                        case 'BR': $vert.css({ right: width }); break;
                        }
                        d.appendChild($vert[0]);
                    }
                }
            }
        }
    });
};

$.fn.uncorner = function() { 
    if (radius || moz || webkit)
        this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
    $('div.jquery-corner', this).remove();
    return this;
};

// expose options
$.fn.corner.defaults = {
    useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
    metaAttr:  'data-corner' // name of meta attribute to use for options
};
    
})(jQuery);

i find out that because of using jquery corner with up-2sp class

$('.up-2sp').corner("top 10px");

how to fix jquery corner function listed below?

/*!
 * jQuery corner plugin: simple corner rounding
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.12 (23-MAY-2011)
 * Requires jQuery v1.3.2 or later
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Authors: Dave Methvin and Mike Alsup
 */

/**
 *  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
 *
 *  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
 *  corners: one or more of: top, bottom, tr, tl, br, or bl.  (default is all corners)
 *  width:   width of the effect; in the case of rounded corners this is the radius. 
 *           specify this value using the px suffix such as 10px (yes, it must be pixels).
 */
;(function($) { 

var style = document.createElement('div').style,
    moz = style['MozBorderRadius'] !== undefined,
    webkit = style['WebkitBorderRadius'] !== undefined,
    radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined,
    mode = document.documentMode || 0,
    noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8),

    expr = $.browser.msie && (function() {
        var div = document.createElement('div');
        try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
        catch(e) { return false; }
        return true;
    })();

$.support = $.support || {};
$.support.borderRadius = moz || webkit || radius; // so you can do:  if (!$.support.borderRadius) $('#myDiv').corner();

function sz(el, p) { 
    return parseInt($.css(el,p))||0; 
};
function hex2(s) {
    s = parseInt(s).toString(16);
    return ( s.length < 2 ) ? '0'+s : s;
};
function gpc(node) {
    while(node) {
        var v = $.css(node,'backgroundColor'), rgb;
        if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') {
            if (v.indexOf('rgb') >= 0) { 
                rgb = v.match(/d+/g); 
                return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
            }
            return v;
        }
        if (node.nodeName.toLowerCase() == 'html')
            break;
        node = node.parentNode; // keep walking if transparent
    }
    return '#ffffff';
};

function getWidth(fx, i, width) {
    switch(fx) {
    case 'round':  return Math.round(width*(1-Math.cos(Math.asin(i/width))));
    case 'cool':   return Math.round(width*(1+Math.cos(Math.asin(i/width))));
    case 'sharp':  return width-i;
    case 'bite':   return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
    case 'slide':  return Math.round(width*(Math.atan2(i,width/i)));
    case 'jut':    return Math.round(width*(Math.atan2(width,(width-i-1))));
    case 'curl':   return Math.round(width*(Math.atan(i)));
    case 'tear':   return Math.round(width*(Math.cos(i)));
    case 'wicked': return Math.round(width*(Math.tan(i)));
    case 'long':   return Math.round(width*(Math.sqrt(i)));
    case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
    case 'dogfold':
    case 'dog':    return (i&1) ? (i+1) : width;
    case 'dog2':   return (i&2) ? (i+1) : width;
    case 'dog3':   return (i&3) ? (i+1) : width;
    case 'fray':   return (i%2)*width;
    case 'notch':  return width; 
    case 'bevelfold':
    case 'bevel':  return i+1;
    case 'steep':  return i/2 + 1;
    case 'invsteep':return (width-i)/2+1;
    }
};

$.fn.corner = function(options) {
    // in 1.3+ we can fix mistakes with the ready state
    if (this.length == 0) {
        if (!$.isReady && this.selector) {
            var s = this.selector, c = this.context;
            $(function() {
                $(s,c).corner(options);
            });
        }
        return this;
    }

    return this.each(function(index){
        var $this = $(this),
            // meta values override options
            o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase(),
            keep = /keep/.test(o),                       // keep borders?
            cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]),  // corner color
            sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]),  // strip color
            width = parseInt((o.match(/(d+)px/)||[])[1]) || 10, // corner width
            re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog|invsteep|steep/,
            fx = ((o.match(re)||['round'])[0]),
            fold = /dogfold|bevelfold/.test(o),
            edges = { T:0, B:1 },
            opts = {
                TL:  /top|tl|left/.test(o),       TR:  /top|tr|right/.test(o),
                BL:  /bottom|bl|left/.test(o),    BR:  /bottom|br|right/.test(o)
            },
            // vars used in func later
            strip, pad, cssHeight, j, bot, d, ds, bw, i, w, e, c, common, $horz;
        
        if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
            opts = { TL:1, TR:1, BL:1, BR:1 };
            
        // support native rounding
        if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
            if (opts.TL)
                $this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
            if (opts.TR)
                $this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
            if (opts.BL)
                $this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
            if (opts.BR)
                $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
            return;
        }
            
        strip = document.createElement('div');
        $(strip).css({
            overflow: 'hidden',
            height: '1px',
            minHeight: '1px',
           
            fontSize: '1px',
            backgroundColor: sc || 'transparent',
            borderStyle: 'solid'
        });
    
        pad = {
            T: parseInt($.css(this,'paddingTop'))||0,     R: parseInt($.css(this,'paddingRight'))||0,
            B: parseInt($.css(this,'paddingBottom'))||0,  L: parseInt($.css(this,'paddingLeft'))||0
        };

        if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        cssHeight = $(this).outerHeight();

        for (j in edges) {
            bot = edges[j];
            // only add stips if needed
            if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
                strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
                d = document.createElement('div');
                $(d).addClass('jquery-corner');
                ds = d.style;

                bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

                if (bot && cssHeight != 'auto') {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.bottom = ds.left = ds.padding = ds.margin = '0';
                    if (expr)
                        ds.setExpression('width', 'this.parentNode.offsetWidth');
                    else
                        ds.width = '100%';
                }
                else if (!bot && $.browser.msie) {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
                    
                    // fix ie6 problem when blocked element has a border width
                    if (expr) {
                        bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
                        ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
                    }
                    else
                        ds.width = '100%';
                }
                else {
                    ds.position = 'relative';
                    ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : 
                                        (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';                
                }

                for (i=0; i < width; i++) {
                    w = Math.max(0,getWidth(fx,i, width));
                    e = strip.cloneNode(false);
                    e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
                    bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
                }
                
                if (fold && $.support.boxModel) {
                    if (bot && noBottomFold) continue;
                    for (c in opts) {
                        if (!opts[c]) continue;
                        if (bot && (c == 'TL' || c == 'TR')) continue;
                        if (!bot && (c == 'BL' || c == 'BR')) continue;
                        
                        common = { position: 'absolute',border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
                        $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
                        switch(c) {
                        case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
                        case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
                        case 'BL': $horz.css({ top: 0, left: 0 }); break;
                        case 'BR': $horz.css({ top: 0, right: 0 }); break;
                        }
                        d.appendChild($horz[0]);
                        
                        var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
                        switch(c) {
                        case 'TL': $vert.css({ left: width }); break;
                        case 'TR': $vert.css({ right: width }); break;
                        case 'BL': $vert.css({ left: width }); break;
                        case 'BR': $vert.css({ right: width }); break;
                        }
                        d.appendChild($vert[0]);
                    }
                }
            }
        }
    });
};

$.fn.uncorner = function() { 
    if (radius || moz || webkit)
        this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
    $('div.jquery-corner', this).remove();
    return this;
};

// expose options
$.fn.corner.defaults = {
    useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
    metaAttr:  'data-corner' // name of meta attribute to use for options
};
    
})(jQuery);

Hi,

It’s better to have a word with Author’s of the plugin! Since they developed the plugin, they will assist you better!

Hope it helps u…

try applying the z-index on the whole table not the table cell ;)

or try putting the table in a <div> and applying the z-index on the <div>

[RESOLVED]Shortcut for inserting event name/method

Hi all

There is no way I’m the only one who thinks that I’m missing such a shortcut in Visual Studio.

In the markup (aspx) I begin writing the event name "On…" then choose the event I need. What I’m looking for now is functionality for auto-inserting the event name and the delegate method in the codebehined exactly as it’s done from the Design view.

It’s a simple and very helpful functionality that’s obviously missing – or I havn’t been able to localize it yet.

Does any one know if it can be done in VS? Maybe using ReSharper?

Thanks

Amit

That would be nice.  The closest I know of is to use the properties window.  You can click the yellow lightening bolt icon, and type the name of the event in there.  This will create the handler in the code behind.  Alternatively, if you’re handling the
default event of the control, you can simply double click the control in design view and it will handle the default event of that control, also creating the handler in the code behind.

In case you’re no aware of these already…

Thanks :)

The properties lightning icon method is about what I was looking for.

As mentioned in my post, I know about the Design thing but was looking for a way to do that from the editor side.

It could have been nicer and faster if (after specifying the type of event directly in the editor) there was a shortcut that produces the dafault name of the event and the event method in the code behined. 99.9% procent of the programmers use the default
given method name for the selected event like: OnPageIndexChanging="MyGridView_PageIndexChanging".

It’s deffenly not a complicated functionality to add to VS :)

Thanks again

Amit