Introduction:- The Gravatar control is an asp.net control that enables you to use gravatar images on your asp.net web pages.This control is very simple to use.You have to just set some Gravatar control's properties like Email, size,Rating DefaultImageBehavior, DefaultImage etc.For this, First you have to Register on http://www.gravatar.com .After that upload your required images which you want to render on your website or blogs.You will get an URL link for every image.Here we will display gravatar images using help of gravatar control.
Before using this concepts you have to Install Ajax toolkit on your visual studio.
There are some properties of Gravatar control as given below:-
5. DefaultImage:- This is required a URL of the image.This image will be displayed,if the gravatar image can not be displayed because of unacceptable rating or the email account is not associated with gravatar.com.Before using this concepts you have to Install Ajax toolkit on your visual studio.
There are some properties of Gravatar control as given below:-
- Email :-This is a required property,You have an email associated with gravatar.
- Size:- This is helpful to render the customize size of images on web page.
- Rating:- This is helpful to display the acceptable rating of image.
- DefaultImageBehavior:-This property is helpful to display the image when a gravatar is not associated with an email account.There are some possible options as given below:-
- MysteryMan:-This is helpful to display the same image of an anonymous profile of a man(a MysteryMan) for all unrecognized email.
- Identicon:- This is helpful to generate different geometric pattern for each unrecognized email.
- Wavatar:- This is helpful to generate a different face of image for unrecognized email.
- MonsterId:-A different image of a monster is generated for each unrecognized email.
- Retro:- This helpful to generate 8 bit arcade-style face for each unrecognized email.
There are some steps to implement this whole concepts as given below:-
Step 1:-First open http://www.gravatar.com -->Create YOur Own Gravatar-->After that upload required images--> Get image Url links and use it any where lik g+ ,fb ,websites or blogs etc.as shown below:-
Step 2:- First open your visual studio-->File -->New-->Web Site-->Select ASP.NET Empty website-->OK-->Now open Solution Explorer Window-->Add a New page(Default.aspx)-->Open Toolbox-->Drag and Drop ajaxToolkitScriptManager control on the page.
Step 3:-Now open Source file-->Drag and drop Gravatar control from the Toolbox-->Sets their property values as given below:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Welcome to MY.NET Tutorials</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<span class="style1"><strong>How to display images using concepts of Gravatar
Control in Ajax</strong></span><br />
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:Gravatar ID="Gravatar2" runat="server"
Email="ramashanker@outlook.com"
Size="250"
Rating="G"
DefaultImageBehavior="MysteryMan"
DefaultImage="https://en.gravatar.com/userimage/107471614/3abf076958ad38f3d01c9a098a728904.jpg"/>
</div>
</form>
</body>
</html>
Step 4:-Now Run the Application(press F5)-->You will See following output a shown below:-Note :- For one email account , you can display only one image at a time but you can change it according to your requirements.For this,You have to set your image on your gravatar account which you want to render.
For More...
- Learn Linq Query with examples
- Learn .net c# sql mvc wpf asp.net wcf Interview questions and answers
- Learn MVC with examples
- Learn Crystal Reports with examples
- Learn Localization and Globalization with real examples
Download Whole Attached file
0 comments:
Post a Comment