My contemplations and diurnal novelties are publicized here

Archive for April, 2012

Eval not working


In Gridview, sometimes we need to pass (Eval(“Column”)) value in javascript function on LinkButton or HyperLink. But you cannot directly pass eval value in javascript function like this

    <asp:LinkButton id=’lnk’ runat=’server’ OnClientClick=’javascript:somefun(‘<%# Eval(“columnname”) %>’)’ />

This will give error. To resolve this problem we need to use bellow syntax.

    <asp:LinkButton id=’lnk’ runat=’server’ OnClientClick='<%#Eval(“columnname”,”javascript:somefun({0});”)%>

If we need to have more than 2 Parameter then we can use

<%# String.Format(“..\\filepath\\{0}\\{1}.jpeg”, Eval(“code”), Eval(“code”))%>

 

 


IE conditional CSS sheets


Hacks are dangerous, since they are based on non-standard exploits, you can’t predict how they are going to behave in future browsers. IE problems can be better solved with conditional stylesheet. IE provides comment tags, supported all the way up to the current IE 10 to target specific versions, as well as greater-than/less-than stuff for targeting multiple versions at once.

Why use conditional stylesheets?

  • You got problems, they need fixing
  • Keeps your code hack-free and valid
  • Keeps your main stylesheet clean
  • Perfectly acceptable technique, sanctioned by Microsoft

And remember, these conditional tags don’t have to be used only for CSS. You could load JavaScript, or even use them down in the content of your site to display special IE-specific messages.

The Code

This would go in your <head> with all the other regular CSS <link> CSS files. The opening and closing tags should be familiar, that’s just regular HTML comments. Then between the brackets, “IF” and “IE” should be fairly obvious. The syntax to note is “!” stand for “not”, so !IE means “not IE”. gt means “greater than”, gte means “greater than or equal”, lt means “less than”, lte means “less than or equal.”

Target ALL VERSIONS of IE

<!–[if IE]>

    <link rel=”stylesheet” type=”text/css” href=”all-ie-only.css” />

<![endif]–>

Target everything EXCEPT IE

<!–[if !IE]><!–>

    <link rel=”stylesheet” type=”text/css” href=”not-ie.css” />

<!–<![endif]–>

Target IE 7 ONLY

<!–[if IE 7]>

    <link rel=”stylesheet” type=”text/css” href=”ie7.css”>

<![endif]–>

Target IE 6 ONLY

<!–[if IE 6]>

    <link rel=”stylesheet” type=”text/css” href=”ie6.css” />

<![endif]–>

Target IE 5 ONLY

<!–[if IE 5]>

    <link rel=”stylesheet” type=”text/css” href=”ie5.css” />

<![endif]–>

Target IE 5.5 ONLY

<!–[if IE 5.5000]>

<link rel=”stylesheet” type=”text/css” href=”ie55.css” />

<![endif]–>

Target IE 6 and LOWER

<!–[if lt IE 7]>

    <link rel=”stylesheet” type=”text/css” href=”ie6-and-down.css” />

<![endif]–>

<!–[if lte IE 6]>

    <link rel=”stylesheet” type=”text/css” href=”ie6-and-down.css” />

<![endif]–>

Target IE 7 and LOWER

<!–[if lt IE 8]>

    <link rel=”stylesheet” type=”text/css” href=”ie7-and-down.css” />

<![endif]–>

<!–[if lte IE 7]>

    <link rel=”stylesheet” type=”text/css” href=”ie7-and-down.css” />

<![endif]–>

Target IE 8 and LOWER

<!–[if lt IE 9]>

    <link rel=”stylesheet” type=”text/css” href=”ie8-and-down.css” />

<![endif]–>

<!–[if lte IE 8]>

    <link rel=”stylesheet” type=”text/css” href=”ie8-and-down.css” />

<![endif]–>

Target IE 6 and HIGHER

<!–[if gt IE 5.5]>

    <link rel=”stylesheet” type=”text/css” href=”ie6-and-up.css” />

<![endif]–>

<!–[if gte IE 6]>

    <link rel=”stylesheet” type=”text/css” href=”ie6-and-up.css” />

<![endif]–>

Target IE 7 and HIGHER

<!–[if gt IE 6]>

    <link rel=”stylesheet” type=”text/css” href=”ie7-and-up.css” />

<![endif]–>

<!–[if gte IE 7]>

    <link rel=”stylesheet” type=”text/css” href=”ie7-and-up.css” />

<![endif]–>

Target IE 8 and HIGHER

<!–[if gt IE 7]>

    <link rel=”stylesheet” type=”text/css” href=”ie8-and-up.css” />

<![endif]–>

<!–[if gte IE 8]>

    <link rel=”stylesheet” type=”text/css” href=”ie8-and-up.css” />

<![endif]–>

Universal IE 6 CSS

Dealing with IE 6 and below is always an extra-special challenge. These days people are dropping support for it right and left, including major businesses, major web apps, and even governments. There is a better solution than just letting the site go to hell, and that is to serve IE 6 and below a special stripped-down stylesheet, and then serve IE 7 and above (and all other browsers) the regular CSS. This is been coined the universal IE 6 CSS.

<!–[if !IE 6]><!–>

<link rel=”stylesheet” type=”text/css” media=”screen, projection” href=”REGULAR-STYLESHEET.css” />

<!–<![endif]–>

<!–[if gte IE 7]>

<link rel=”stylesheet” type=”text/css” media=”screen, projection” href=”REGULAR-STYLESHEET.css” />

<![endif]–>

<!–[if lte IE 6]>

<link rel=”stylesheet” type=”text/css” media=”screen, projection” href=”http://universal-ie6-css.googlecode.com/files/ie6.0.3.css&#8221; />

<![endif]–>

How to allow optional characters in jquery maskedinput


I recently need to allow optional characters in jquery like

I google and found a solution

$(“#yourcontrolId”).mask(“?99999999″);

You can add ? (Question mark) before the character to make them optional.

You can also change it to

$(“#yourcontrolId”).mask(“99999?999”);

Above will make only 3 characters optional

IE text not aligning in center


In IE 7 if you use

min-width: 90px;

this will conflict with

text-align: center;

So better not to use

Min-width with text-align

Jquery grids for asp.net


  1. jQuery Grid for ASP.NET MVC
  2. jqGrid 4.3.2 Downloads (Free, Open Source package)
  3. Flexigrid
  4. Ingrid
    1. Another nice demo
  5. DataTables
  6. Sigma Ajax Grid (Demos)
  7. dhtmlxGrid
  8. jqwidgets
  9. kendoui

Must have twitter utilites


1. Bit.ly

This URL shortener not only shrinks links down to about 20 characters, it also keeps track of your links for you and provides some basic analytics to see how many people click and retweet the links and where those users are coming from.

2. Twitpic

Twitpic allows you to take a photo on your mobile phone and email it to a customized Twitpic email address. You simply type your tweet into the subject line of the email.

3. Tweetscan

Tweetscan scans Twitter for your keywords and sends you a daily or weekly email of all instances where your keywords were used. This can be especially helpful for tracking brands. Service is not free and costs $20/year.

4. Twitterfeed

Twitter is great for promoting blog posts and other types of content. If you have a blog and you want to automatically send out a tweet every time there’s a new post, then Twitterfeed can do it for you. It also has some nice customization options. WordPress do provide a buildin publicizing mechanism as

5. TwInbox

If you live in Microsoft Outlook — like many business professionals — and would prefer to interact with Twitter from there, TwInbox integrates Twitter into Outlook. And, the product is free. It was formerly known as OutTwit.

6. CoTweet

CoTweet provides an entire business workflow for companies that are serious about using Twitter for business. CoTweet allows you to manage multiple Twitter accounts, it allows multiple users to access a single account, it can assign tweets to employees for follow-up, it can monitor keywords and trends, it can track clicks to links, and it can allow employees to schedule tweets out into the future. This is not a free tool. (See also: HootSuite)

7. TweetStats

This site provides statistics for individual Twitter users. Simply plug in the person’s Twitter username and you’ll get a plethora of stats, such how often a person tweets, when the person tweets the most, who the person replies to most often, who the person retweets the most and which interface the person used the most to post on Twitter. (See also: TwitterGrader)

8. Twuffer

This free tool allows you to schedule tweets out into the future. For example, I like to post an inspirational quote of the day on Twitter. But sometimes when I’m looking up quotes I’ll come across with several good ones at a time. So, I use Twuffer to spread them out over several days.

9. Twtpoll

One of the most useful things to do on Twitter is to crowd-source a question or ask a quick straw poll. Twtpoll is a tool that makes it very easy to officially do a poll. (See also: StrawPoll)

10. Twendz

If you want to see watch how a keyword has been viewed over time, Twendz provides a very simply and useful chart. The chart is updated in real time. (See also: Twazzup, Twist, and Twittercounter)

Reference:- http://www.zdnet.com/blog/btl/10-valuable-twitter-utilities-for-business-users/22750?tag=content;siu-container

%d bloggers like this: