Monday, August 31, 2009

set meta tags to master page from Child Page

Meta tag ,title, keywords ,Description and all are very assential on each page , if your using asp.net with Master page then also its possible some people think that how it can be? master page means one page and it get call on each child page creation.but you can also add the keyword , title and all with each pertucular page if you'r using master page then also.

Below are the Steps you need to follow

1-

Create oen Content place holder on your master page with in HEAD section


<head id="Head_Demo" runat="server">
<asp:ContentPlaceHolder runat="server" id="Contentplace_Demo"> </asp:ContentPlaceHolder>
</head >


2 -

on Your Child page put this code :

<asp:Content runat="server" ContentPlaceHolderID="ContentHeaders" ID="Content_Demo" >
<META name="keywords" content="<%=pgKeywords%>">
<TITLE><%=pgTitle%></TITLE>
<META name="description" content="<%=pgDescription%>">
</asp:Content>


3 -

on content page's(Child page) open CodeBehind and Declare this :
Declare variables as below in the global declaration section

Protected pgKeywords As String = ""
Protected pgTitle As String = ""
Protected pgDescription As String = ""


4-
Now set the New title, Desc and all as per the your req. copy that code on page_load Event

pgKeywords = "keywords Content Goes here "
pgTitle = "title Content Goes here"
pgDescription = "Description Content Goes here"

or you can also refer this set mata tags

that's it
hope it will helps you

Friday, August 28, 2009

How to get Mouse Cursor Position

There is no Certain way to find the Cursor position of mouse within the Browser.
W3c standards say that you can get the position when event is triggered by event.clientX and same for clientY. to find out the Distance between left n Top

side.

Its works fine on IE6 , Netsacape , Firefox , Opera 7+ and all othe browser.
in IE uses two Different ways to scroll the position of pages they are using Document.body.ScrollLeft and same for the ScrollTop. this is in Before version

of 6
Some of the Browser used PageXOffset & PageYOffset.

Here is Function call MouseX() and MouseY() which can calculate the X and Y Co-ordinates of same,


function mXbar(action) {
if (action.pageX) return action.pageX;
else if (action.clientX)
return action.clientX + (document.documentElement.scrollLeft ?document.documentElement.scrollLeft :document.body.scrollLeft);
else return null;
}
function mYbar(action) {
if (action.pageY) return action.pageY;
else if (action.clientY)
return action.clientY + (document.documentElement.scrollTop ?document.documentElement.scrollTop :document.body.scrollTop);
else return null;
}



there are few more ways to calculate the cursor position event.ScrenX or event.screenY
these feature are not thee in Netscape4 and IE old version, but in new version of ie 7 + they have all such feature,

Tuesday, August 18, 2009

Best Ajax , Jquery ,Css Calendar collections

Calendar is one of the requirement while taking a input from user in terms of
Data of Birth , Start Journey , Admission Date and so many .its a Essential Control in terms of all the Application Development.

here are the some cool and nice collections of calendar most of them are in ajax, css , and Jquery . hope you like it .

1. VLA Calendar



2. ASP.Net calendar



3. Date Input Calendar



4. using Prototype date picker



5. Jquery Calendar



6. Date and Time Picker




hope u like this collection , will keep on updating ,
if u know any one in this plz send a comment on it,

Thursday, August 13, 2009

Handle Master page Click Event on Content Page

In ASP.net2.5 there a new concept knowns as Master Page , with the help of that you can
customize you'r repeteative work. Create a one Master page and use that page on all the other pages. Its really very good tech to crear your coding and clear your logic also.

now sometime we have a LinkButton define on Master page which can be work as a "Link to the Customer information " and this can be change depend on customer role. and that LinkButton action we want in the Contenet page.

Supoose we have LinkButton call "linkFromMasterPage" on Master Page. Here is small code which can helps you to do same .

C#--

Public LinkButton linkFromMasterPage(){

Get {

Return linkFromMasterPage;

}

}


Now next Process is reference the Master Page as a casted object in the Content page.
here CusMasterPg is a Class of Maste Page.


CusMasterPg cm = ((CusMasterPg) (Master));


Now you can easily access the all the methods, public properties of Master page class.
so next stpe is handle the button Event on your content page


protected void Page_Load(object sender, EventArgs e)
{
If (!(IsNothing(cm))) {

cm.linkFromMasterPage.Click += New EventHandler(linkFromMasterPage_Click);

}
}


next thing is define actual method handle on your page.


Protected void linkFromMasterPage_Click(Object sender, System.EventArgs e){

// write Perform Business Logic Here
}


thats all , you can do same thing for User Controls also for Handle Master page Click Event on Content Page.

Wednesday, August 12, 2009

ASP.NET Cross Site Scripting Toolkit

hi i have found some very much useful related with the Cross site Scripting.
cross site scripting is very common method to hack a site, most of the hacker get hack the site with the some basic scripting techniques.

now Microsoft get Introduce the Toolkit to Prevent the Cross-site Scripting not exactly preventing but you can say some basic level of Prevention. this toolkit is supposed to be offer some extra good efforts against the type if attack.

Cross Site Scripting may be done using -
1. via QueryString
2. via Text box entry
and so many

download Microsoft Anti-Cross Site Scripting Library toolkit here

Silverlight-based Local Impact Map

It is one of the Great and very Interestig web application devlope by Microsoft ,
there are some reason to devlop this.

The Local Impact Map are conatin around 400+ Stories about the Program of Microsoft around the world.In that you can see it includes the Photos videos and more and more Visual Effects.

It is very interesting and easy to use , i like the one of that feature of Deep Zooming of Map, its really cool and very fast , Its not a ' free mouse-wheelin ' where you can zoom the Preticular location , they are taking advantage of Deep Zooming of image along with zoomo for Controlled Transition.

Microsoft’s Silverlight-based Local Impact Map

plz have a look at this cool Local Imapct of Map

Wednesday, August 5, 2009

ASP Format Date and Time

while coding on ASP we required date and time most of the time, how to get this is very basic and well known to the most of the Programmers, but how to get the only specific date , time in required format is a main task ,

for that we have inbuild function call FormatDateTime() .

now we very well knows if we want to get current date and time then we can use now()

<%dim TodayDnT
TodayDnT = now()
%>

if you want the Result of same then use <% Response.write(TodayDnT) %>
so it will return result as : - 8/5/2009 12:11 PM

now we have the option to format that
1. Using 0

<%
Response.write FormatDateTime(TodayDnT,0)
%>

Result : - 8/5/2009 12:11:10 PM


2. Using 1

<%
Response.write FormatDateTime(TodayDnT,1)
%>

Result :- Wednesday, August 12, 2009 (long date )


3. Using 2

<%
Response.write FormatDateTime(TodayDnT,2)
%>

Result: - 8/5/2009 (short date)


4. using 3

<%
Response.write FormatDateTime(TodayDnT,3)
%>

Result : - 12:11:10 PM (long time)


5. using 4

<%
Response.write FormatDateTime(TodayDnT,4)
%>

Result : - 11:10 (current time in 24 format (hh:mm)


If you want to change the Date and Time according to international location then
use session.lcid property

Ex : - <% session.lcid=1036 %>
which will set the Date n Time in French Format

here is the List of all the
International Location

Monday, August 3, 2009

Debugging for ASP.NET Applications

If you are using Visual Studio2005 and if you want to enable debugging in the project properties Then Follow the Stpes
In VS 2005, use the <Project> Property Pages to set project properties :
here is the way to do
- Right click on Solution Explore of Project,Then Open the Property Pages by and selecting Property Pages.
- Select Start Option tab
- Under Debuggers, make sure the ASP.NET box is selected.

You can also enable the debugging using web.config file

- Inside the <compilation> tag, you will create the debug attribute.
- specify attribute as a "debug", not "Debug" or "DEBUG" because the are very Case-Sensitive so please take care of that.
- Set debug option as a true.

Here is a sample Web.config file


<configuration>
<system.web>
<compilation defaultLanguage="VB" debug="true" numRecompilesBeforeAppRestart="15">

<compilers>
<compiler language="C#;Csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,system, Version=1.0.5000.0, Culture=neutral,

PublicKeyToken=b77a5c561934e089" />
<compiler language="VB;VBScript" extension=".cls" type="Microsoft.VisualBasic.VBCodeProvider,system, Version=1.0.5000.0, Culture=neutral,

PublicKeyToken=b77a5c561934e089" />
</compilers>

<assemblies>
<add assembly="ADODB" />
<add assembly="*" />
</assemblies>

<namespaces>
<add namespace="System.Web.UI" />
<add namespace="System.Web" />
<add namespace="System.Web.UI.WebControls" />
<add namespace="System.Web.UI.HtmlControls" />
</namespaces>
</compilation>
</system.web>
</configuration>


Like that you can set the Debugging option using web.config file also and using GUI also.

Saturday, August 1, 2009

Loop through Session ,Application ,form Variable

In Classic asp sometime we need to retrieve all the Session Application and Request object variable, in this case we can use Loop through technique which will generate all the Session variable , application variable , and Request variable are used in current page do this need to simply put this line on your page

1.

<%
dim i
For Each i in Session.Contents
Response.Write(i & "<br />")
Next

dim i
For Each i in Session.StaticObjects
Response.Write(i & "<br />")
Next
%>

it will Display all the Session Contents / session staticobjets are used in current page .


2.

<%
dim i
For Each i in Application.Contents
Response.Write(i & "<br />")
Next
%>


this will iterate all the Application content are being used in current page.

3.

<%
for each x in Request.form
Response.Write("<br>" & x & " = " & Request.form(x))
next
%>


this will generate all the Request variable


4.


<%
for each name in Request.ServerVariables
Response.write ""&name &"-------------"& Request.ServerVariables(name) &"<br>"
Next
%>

it will loop with the all the Server Variable.