Friday, October 30, 2009

How to Add digg button to all posts on your blogspot blog

How to Add Digg Button ,


  • Open your Blogger Dashboard

  • Click on Layout > Edit Html part.

  • now Click on Expand Widget Templates

  • Seach for <data:post.body/ >

  • Paste the Below code above the searched text


  • <script type="text/javascript" >
    digg_url = 'WEBSITE_URL';
    digg_bgcolor = '#ff9900';
    digg_skin = 'compact';
    digg_window = 'new';
    </script >
    <script src="http://digg.com/tools/diggthis.js" type="text/javascript" > </script>


  • digg_bgcolor - change the background color

  • digg_window - set is 'New' when you want to open page on new window

  • digg_skin - its a optional control by default it is yellow , you can change it according to you

  • digg_url - 'WEBSITE_URL'; here just enter URL of the page


  • you can omit all the attribute , but you can't omit digg_url - its your post url submitting to digg.
  • now you can click on save your template , it will take effect soon .


happy digging..

Wednesday, October 28, 2009

Add Image in between Rows of a GridView using C#

again i come up with some new tips on Gridview , there are lots many things are there in Gridview . now my this article is describe you how to add the image on Gridivew, you can say after perticular records then you can use " OnRowDataBound " Property or " onRowCreated " like first 5 records then some distinguished between next 5 records like that.
here are the stpes how you can do that.

1. Create one Application
2. Add the Gridview control on a page ,also add the data source for same ,and just simply link it with some sample table
3. consider below is your Gridview code


<asp:GridView ID="GridView1" DataSourceID="SqlDataSource1" AllowPaging="True"
AutoGenerateColumns="False" DataKeyNames="CustomerID"
runat="server" OnRowDataBound="GridView1_RowDataBound" AllowSorting="True">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" />
<asp:BoundField DataField="Name" HeaderText="Name" />
</Columns>
</asp:GridView>


4. now suppose if i want to add new row which is background , then i have to add Gridview_RowDataBound event , this will enable you to provide the Event-Handling method which will perform the Custom routine option. that can be like modiffy the row, add the new record into the row and so on.now for that we are adding page level varible call pSize which will hold the Row position where we want to add that image column, with same also add that image to your Gridview
below code will help you .



static int pSize;

protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
pSize = 0;
}

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

TableCell TabCell = new TableCell();
Image img = new Image();
img.ImageUrl = "Photo.gif";
TabCell.Controls.Add(img);

GridView gView = (GridView)sender;
int colSpan = gView.Columns.Count;
TabCell.Attributes["ColSpan"] = colSpan.ToString();

GridViewRow gRow = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);

gRow.Cells.Add(TabCell); // add the cells to the gridviewrow

Table newtbl = (Table)e.Row.Parent;

if(pgSize == 0)
pgSize = GridView1.PageCount / 2;

if (Convert.ToDouble(e.Row.DataItemIndex + 1) / Convert.ToDouble(pgSize) == 1.0)
{
newtbl.Controls.AddAt(gView.Controls[0].Controls.Count, gRow);
// add 10 to the pgsize so that the image can be displayed
// at rows 5, 15, 25 and so on..
pgSize = pgSize + 10;
}



here you can see how its look like:



hope this example will helps you .

Thursday, October 15, 2009

IIS SEO Toolkit helps Web developers

The IIS Search Engine Optimization (SEO) Toolkit helps Web developers, hosting providers, and server administrators improve their sites' relevance in search results by recommending how to make them more search engine-friendly. The IIS SEO Toolkit Beta can be installed with the Microsoft Web Platform Installer 2.0 Beta for use with IIS 7.0 and IIS 7.5.

For or more details on IIS SEO Toolkit

Wednesday, October 7, 2009

youtube search api using C#

hi , i have allready specify how you can use youtube api in your .net application, here is my next post on same topic , you can add Youtube Search widget on your web site using API SEARCH method ,XmlDataSource control can be used in ASP.Net to bind the Youtube API RSS response to display the Youtube videos.

if you are using .Net then Repeater Control is one of the best option to display result . at first you need to create api method url to retrive the result from youtube in terms of RSS Feed. you can also Use of XmlNamespaceManager to read that Rss feed having media namespace that provides the syndication content about Youtube videos

- Google Code for Youtube API and Tools

http://code.google.com/apis/youtube/developers_guide_protocol.html#Searching_for_Videos

Steps to add simple YouTube search page to your ASP.NET web site


  • first get a free Developer Key:  http://youtube.com/signup?next=/my_profile_dev.

  • now you need to construct uri like this

    string uri = "http://www.youtube.com/api2_rest?";
    uri += "method=youtube.videos.list_by_tag";
    uri += "&dev_id=" + developerKey;
    uri += "&tag=" + txtSearch.Text;
    uri += "&page=1&per_page=50"; //


  • now you can get the returned result in an XML document,now load the XML into a DataSet using its ReadXml method.


now create one page and in that create one text box and one submit button
put this code on codebehind


protected void Button1_Click(object sender, EventArgs e)
{
string developerKey = "" // put your key here;
if (developerKey.Length == 0)
{
Response.Write("You need to get a YouTube

developer key
first!");
return;
}
// Call the YouTube api to list all videos for a tag
string uri = "http://www.youtube.com/api2_rest?";
uri += "method=youtube.videos.list_by_tag";
uri += "&dev_id=" + developerKey;
uri += "&tag=" + txtSearch.Text;
uri += "&page=1&per_page=50"; // you can add custom paging if desired
DataSet ds = new DataSet();
ds.ReadXml(uri);
DataTable dt = ds.Tables[2];
this.DataList1.DataSource = dt;
DataList1.DataBind();
}



and here is your datalist code

<table>
<asp:Datalist id="DataList1" runat="server" CellPadding="2" CellSpacing ="2" BorderStyle="None">
<FooterStyle BackColor="#CCCCCC" ForeColor="Black"></FooterStyle>
<ItemTemplate>
<tr > <td colspan="2" align=center> <b> <%# DataBinder.Eval(Container, "DataItem.title") %> </b> </td> </tr>
<tr>
<td style="width:100px;Height:20px;">
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("url") %>' >
<asp:Image ID="Img" ImageUrl='<%#Eval("thumbnail_url") %>' runat="Server" />
</asp:HyperLink>
</td>
<td style="width:450px;Height:20px;"><%# DataBinder.Eval(Container, "DataItem.description") %></td>
</tr>
</ItemTemplate>
</asp:Datalist>
</table>


view demo
that's it , happy youtubing...

Tuesday, October 6, 2009

Test Your Website in Different Browsers and Platforms

ones we develop any application or any website then basically we are testing that site on different browser or different platform but its very time consuming and time taking , at first we have to install that browser and then we have to test that, but if you want to test your web application or website in different browsers,and different platforms in easiest way then Browser shots will help you.It makes screen shots of your web design in different browsers. It is a free open-source online service.

its very simple you need to submit your web address, it will be added to the job queue. A number of distributed computers will open your website in their browser. Then they will make screen shots and upload them to the central server of Browsershots. It supports Windows ( Firefox 1.5, Internet Explorer 5.0 and 6.0 ), Mac (Firefox 2.0, Safari 2.0 ), Linux ( Iceweasel 2.0, Konqueror 3.5 ). and more

you can also test your application here http://browsershots.org/
its a open source applciation , you can download that images ones you test your application ,and then make a changes according to same,

hope you like this .

Saturday, October 3, 2009

free online editors for your asp.net application

Editor is one of the requirement while taking the long input from the user , just like there
long long comments, about us , comments, and many more editor play important role in this case , you can edit that text as per you want you can use all html tags and all to make your reply or comments or text better.
here are the some free online editor you can integrate that on you .net web application.

1. widgEditor

widgEditor
Download widgEitor
Demo

2.markItUp

markItUp
Download martkUp!
Demo

3. Yahoo! UI Text Editor

Yahoo
Download Yahoo!UI Text Editor
Examples


4. NicEdit
NicEdit is a Lightweight, Cross Platform, Inline Content Editor
NicEdit
Download NicEdit
Demo

5. JWYSIWYG

JWYSIWYG
Download JWYSIWYG
Demo



free online editors for your asp.net application

Friday, October 2, 2009

Enhanced country selection with Css and Javascript

When we designing a Registration form , Country & state option are consider, in that time we prefer Drop down option to populate various state or country and user get select one of them , its a very old process , you can redevelop that using ajax, css ,javascript and so many other ways ,

here is very nice way to select Country using simple CSS and Javascript


as you can see , you need to move your mouse over the text box and various country with there flag drop down get populate and you can selete one of the country on same , and that country name will appear in that text box

Download source

hope you like it ,