Posts Tagged ‘Asp.Net’

jquery.autocomplete ( facebook search box )

First i would like to thank fromvega for his super awsome work explaining Autocomplete plugin he made

I learned allot from his work and built over it adding some new functionalities and spicing it up

By adding some more good plug-in like highlight-3.yui,

So i was looking through the web searching for a good plug-in search box that is inspired by the contacts search box

In face book and the best plug-in i found was Facebook like Autosuggestion

It was a very good plug-in but i must say it didn’t have some functionalities like the important up/down arrow keys selections also it didn’t highlight the searched text in the suggestions list and when selecting one of the options it didn’t automatically redirect to a target page … Also one of the features i noticed that it didn’t clear the options if the we cleared the search box

So i decided to make my own plug-in that looks exactly the same like the face book search box … You don’t believe me here you go a screen shoot

Or you can try out the Online Demo

So i went through the development path and i wanted to make really simple as one line of code and this what it takes to make the autosuggestion search box now

$("#searchbox").AutoComplete("search.aspx?searchword=");

Very easy haaa ? :-)

You can Visit the Plugin Offical Page on the JqueryPlugins

Or you can direclty Download Plugin

You can also get the source code for the Online Demo Code

So now let us go through step by step in order to use the plug-in

Step 1 : download the plug-in files

Step 2 : include them in the project

Step 3 : add reference to the right files in the html code

<link href="styles/css/jquery.autocomplete.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="http://www.google.com/jsapi"></script>

<script type="text/javascript">google.load('jquery', '1.3.2');</script>

<script src="styles/js/jquery.autocomplete.js" type="text/javascript"></script>

<script src="styles/js/jquery.dimensions.js" type="text/javascript"></script>

<script src="styles/js/jquery.highlight-3.yui.js" type="text/javascript"></script>

Step 4 : create the html text box and give it ID let us say "DemoSearchBoxID"

Step 5 : add the script calling the plugin

$(function () { 

    $("#DemoSearchBoxID").AutoComplete("search.aspx?searchword="); 

});

Step 6 : develop the Asp.Net search Page in my case "search.aspx" which takes the parameter in the query string

search word having the value of the search box

This page will be called with ajax calls during each key up event of the search box, it should be very simple page to developed for experienced developer.

On the ajax call i am searching in the output result of the search page for a div with id "divAutoCompleteSearch"

And render its html content in the autosuggestions list

The divAutoCompleteSearch should contain list of result divs and each result div should contain two hidden fields with IDS "hdnValue " and "hdnUrl "

hdnValue = the value that will be copied to the search box when selecting this result

hdnUrl = the url the page will be redirected to when selecting this result

Example of the expected output html from the search.aspx

<div id="divAutoCompleteSearch">

 

  <div class="unselected">

    <input id="hdnValue" type="hidden" value='Egypt' />

    <input id="hdnUrl" type="hidden" value='http://targetUrl' />

    <img alt="" src='Egypt.jpg' width="45px" height="45px" />

    Egypt

  </div>

 

  <div class="unselected">

    <input id="hdnValue" type="hidden" value='Denmark' />

    <input id="hdnUrl" type="hidden" value='http://targetUrl' />

    <img alt="" src='Denmark.jpg' width="45px" height="45px" />

    Denmark

  </div>

 

</div>

As i said <div class="unselected"> can contain any html you want to display in the suggestions list any think will work as long as you have the two hidden fields included.

I hope that made it easier for you to use and you make a great use of this plug-in ,i will be happy if you do

You love the topic :-) ? Let me hear what you think … Please give me your comments bellow or Retweet This :-)

Cheers for all jQuery Users.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

jQuery for Everyone

A Very cool Tips and handy Tools to be used with share point can

Be found on those create topics Jquery for everyone :)

Hope you enjoy them

Entries in this series:

  • JQuery for Everyone: Accordion Left Nav
  • JQuery for Everyone: Print (Any) Web Part
  • JQuery for Everyone: HTML Calculated Column
  • JQuery for Everyone: Dressing-up Links Pt1
  • JQuery for Everyone: Dressing-up Links Pt2
  • JQuery for Everyone: Dressing-up Links Pt3
  • JQuery for Everyone: Cleaning Windows Pt1
  • JQuery for Everyone: Cleaning Windows Pt2
  • JQuery for Everyone: Fixing the Gantt View
  • JQuery for Everyone: Dynamically Sizing Excel Web Parts
  • JQuery for Everyone: Manually Resizing Web Parts
  • JQuery for Everyone: Total Calculated Columns
  • JQuery for Everyone: Total of Time Differences
  • JQuery for Everyone: Fixing Configured Web Part Height
  • JQuery for Everyone: Expand/Collapse All Groups
  • JQuery for Everyone: Preview Pane for Multiple Lists
  • JQuery for Everyone: Preview Pane for Calendar View
  • JQuery for Everyone: Degrading Dynamic Script Loader
  • JQuery for Everyone: Force Checkout
  • JQuery for Everyone: Replacing [Today]
  • JQuery for Everyone: Whether They Want It Or Not
  • JQuery for Everyone: Linking the Attachment Icon
  • JQuery for Everyone: Aspect-Oriented Programming with jQuery
  • JQuery for Everyone: AOP in Action – loadTip Gone Wild
  • JQuery for Everyone: Wiki Outbound Links
  • JQuery for Everyone: Collapse Text in List View
  • JQuery for Everyone: AOP in Action – Clone List Header
  • JQuery for Everyone: $.grep and calcHTML Revisited
  • JQuery for Everyone: Evolution of the Preview
  • JQuery for Everyone: Create a Client-Side Object Model
  • JQuery for Everyone: Print (Any) Web Part(s) Plugin
  • JQuery for Everyone: Minimal AOP and Elegant Modularity
  • JQuery for Everyone: Cookies and Plugins
  • JQuery for Everyone: Live Events vs. AOP
  • JQuery for Everyone: Live Preview Pane
  • JQuery for Everyone: Pre-populate Form Fields
  • JQuery for Everyone: Get XML List Data with OWSSVR.DLL (RPC)
  • Use Firebug in IE
  • JQuery for Everyone: Extending OWS API for Calculated Columns
  • JQuery for Everyone: Accordion Left-nav with Cookies Speed Test
  • JQuery for Everyone: Email a List of People with OWS
  • JQuery for Everyone: Faster than Document.Ready
  • jQuery for Everyone: Collapse or Prepopulate Form Fields
  • jQuery for Everyone: Hourly Summary Web Part
  • jQuery for Everyone: "Read More…" On a Blog Site
  • jQuery for Everyone: Slick Speed Test
  • jQuery for Everyone: The SharePoint Game Changer
  • JQuery For Everyone: Live LoadTip

Inserted from <here>

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

What is New In C# 2.0 , 3.0 , 3.5, 4.0 ( road map)

What is New In C# 4.0

Dynamic lookup

dynamic d = 7;

d = “Abdel-Rahman”;

Named and optional parameters
public void M(int x, int y = 5, int z = 7);

M(1, 2, 3); // ordinary call of M 

M(1, 2); // omitting z – equivalent to 

M(1, 2, 7) 

M(1); // omitting both y and z – equivalent to M(1, 5, 7) 

 

M(1, z: 3); // passing z by name 

M(x: 1, z: 3); // passing both x and z by name 

M(z: 3, x: 1); // reversing the order of arguments

COM specific interop features

This means that you can easily access members directly off a returned object, or you can assign it to a strongly typed local variable without having to cast. To illustrate, you can now say

excel.Cells[1, 1].Value = "Hello"; 

 

// instead of 

 

((Excel.Range)excel.Cells[1, 1]).Value2 = "Hello"; 

 

Excel.Range range = excel.Cells[1, 1]; 

 

// instead of 

 

Excel.Range range = (Excel.Range)excel.Cells[1, 1];

Variance

// ToDo : 1.0 Add Example.

What is New In C# 3.0 , C# 3.5

you can see my old post about C# 3.0 here , but i think i ll write about it here in more details.

Automatic  Properties
public int MyProperty { get; set; }

Implicitly Typed Local Variables
var n = 5;

var s = “LINQ rules”;

var b = new[] { 1, 1.5, 2, 2.5 };

var c = new[] { "hello", null, "world" };

Anonymous Types

var anonType = new {X = 1, Y = 2};

var NewTempClass = new {FirstName = "name" , Age = 32 };

string x = NewTempClass.FirstName;

Object Initializes
Contact contact = new Contact { LastName = “Magennis”, Age = 9 };

Collection Initializers
List<int> digits = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

List<Contact> contacts = new List<Contact>

{ new Contact {LastName = “Doherty”, DOB =55},new Contact {LastName = “Wilcox”, DOB = 66} };

Extension Methods

They made a new generic methods so you can extend the functionality of any class you want

public static int NewExtensionMethod(this string s) {return Int32.Parse(s); }

Partial Methods
Query Expressions
var result = from item in List.items Where item.Title = ”Abdel”

select item;

Lambda Expressions
IEnuerable <Person> results = People.Where( P => P.LastName ="Abdel");

double Averageage = People.Average(P => P.Age);

Expression Trees

 

What is New In C# 2.0

Generics
class BaseNode { }

class BaseNodeGeneric<T> { }

class NodeConcrete<T> : BaseNode { }

class NodeClosed<T> : BaseNodeGeneric<int> { }

class NodeOpen<T> : BaseNodeGeneric<T> { }

class BaseNodeMultiple<T, U> { }

class Node4<T> : BaseNodeMultiple<T, int> { }

class Node5<T, U> : BaseNodeMultiple<T, U> { }

class SuperKeyType<K, V, U>  where U : System.IComparable<U>  where V : new() { }

static void Swap<T>(ref T lhs, ref T rhs)

class SampleClass<T> 

{ 

 void Swap(ref T lhs, 

ref T rhs) { } 

}

Iterators
  • An iterator is a section of code that returns an ordered sequence of values of the same type.

  • An iterator can be used as the body of a method, an operator, or a get accessor.

  • The iterator code uses the yield return statement to return each element in turn. yield break ends the iteration. For more information, see yield.

  • Multiple iterators can be implemented on a class. Each iterator must have a unique name just like any class member, and can be invoked by client code in a foreach statement as follows: foreach(int x in SampleClass.Iterator2){}

  • The return type of an iterator must be IEnumerable, IEnumerator, IEnumerable<T>, or IEnumerator<T>.

The yield keyword is used to specify the value, or values, returned. When the yield return statement is reached, the current location is stored. Execution is restarted from this location the next time the iterator is called.

Iterators are especially useful with collection classes, providing an easy way to iterate non-trivial data structures such as binary trees.

Partial Classes
Nullable Types

example int? x = null; int y = x ?? -1;

Use the System.Nullable.GetValueOrDefault

The syntax T?

Anonymous Methods

Del d = delegate(int k) { /* … */ };

Static Classes
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

JQuery Notes

JQuery Selectors

$(“#firstname”)

select element with id firstname

$(“:text”)

select all text boxes

$(“.required”)

select all elements with required class

$(“#grad tr:even”)

select even rows from an element with an id of grad

JQuery Animation

$(..).Show()

$(..).Hide()

$(..).SlideDown()

$(..).SlideUp()

$(..).FadeIn()

$(..).FadeOut()

to be continued …

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

SharePoint CSS

A great topic explaining all the SharePoint style classes and names

 

Enjoy ; – )

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

SharePoint Sending Email

Here you go the code for sending email within the SP context

 

using Microsoft.SharePoint.Utilities;SPUtility.SendEmail(SPContext.Current.Web, false, false, "to-address@mail.com", "E-mail title", "E-mail body");

more details here

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

Filter InfoPath

Some times we need to hide some fields in the InfoPath form according to the logged in user
so this where i found how to do it…

 

Enjoy

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

MasterPage PlaceHolders

I was searching for a good description of each of the SharePoint master page placeholders and the names of each one and i found that good Link

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

Create Layout ContentTypes

If you want to create a layouts publishing templates inheriting from parent content types

using xml files a very good link describing all that

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

InfoPath to SharePoint with Relative Data Connection

I was trying to automate the deployment process of the InfoPath form to a SharePoint list and also make the dataconnetion relative to the server and the site collection it is deployed to and i have found a very good links to do that

InfoPath List

InfoPath DataConnection

InfoPath Feature

Xml From InfoPath

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

 

View Abdel-Rahman Awad's profile on LinkedIn

Archives

 

Rss Feed Tweeter button Facebook button Linkedin button Delicious button Digg button