Thursday, June 23, 2011

Embed youtube video without youtube link



<object style="height: 390px; width: 640px">
<param name="movie" value="http://www.youtube.com/v/u1zgFlCw8Aw?version=3">
<param name="allowFullScreen" value="true">
<param name="allowScriptAccess" value="always">
<embed src="http://www.youtube.com/v/u1zgFlCw8Aw?version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390"></object>

Sunday, June 19, 2011

How to check the value in querystring is number or not in Asp.Net

if (!String.IsNullOrEmpty(Request.QueryString["Id"]))
 {
   string Id = Request.QueryString["Id"].ToString();

   if (Id != "")
     {
        int numeber = 0;
        if (int.TryParse(Id, out number))
          {
         //code
          }
         else
          {
            Server.Transfer("Error.aspx");
          }
     }
     else
      {
         Server.Transfer("Error.aspx");
}

 }

Wednesday, June 1, 2011

ASP.NET GridView And Conditional Images

Depending upon a value in the data source, we can conditionally display images in GridView columns. For example, the following TemplateField declaration conditionally displays approved.gif or unapproved.gif based on IsApproved flag in the DataSet that the GridView is bound to:


 <asp:TemplateField HeaderText="Approval Status"> 
<ItemTemplate> 
<asp:Image ID="ApprovalImage" runat="server" ImageUrl='<%# "~/Images/" + (((bool)Eval("IsApproved") == false) ? "Unapproved.gif" : "Approved.gif") %>' /> 
</ItemTemplate> 
<ItemStyle Width="25px" /> 
</asp:TemplateField> 

Ajax CalendarExtender displaying at wrong position in Chrome

< script type ="text/javascript" language ="javascript">     function onCalendarShown(sender, args)...