Pages

Calling Server side Event handler function Uisng Ajax Update pannel

1)Add Script manger to a page 2)Add Update panel in your page 3)Add any Server side standard Control . 4)In update panel call trigger tag .Inside trigger tag call asp:AysncPostBackTrigger control tag 5)Provide control id & eventname in above tag 6)Example below is assign Textbox value on buttin click
pseduocode aspx code //Asume one button control id="bttnAjax" and one textbox in content template of update pannel id=txtAjax"
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<Triggers >
<asp:AsyncPostBackTrigger ControlID="bttnAjax" EventName="click"/>
</Triggers>
<ContentTemplate>
<asp:TextBox ID="txtAjax" runat ="server"/>
</ContentTemplate>
</asp:UpdatePanel>

Code Behind
protected void bttnAjax_Click(object sender, EventArgs e)

{

txtAjax.Text="Welcome To Ajax World "

}







Calling code behind function using Ajax

1)Drag scriptmanger in your web page add attribute EnablePageMethods="true" 2)Create functions in javascript section (method name are similar example)       I)CallPageMethod()      II)CallParmeterPageMethod()      III)onSucceeded(result,userContext,MethodName)      IV))OnFailed(error,user) 3)Create static and return string function in Code behind (method name are similar example)     I)MyFirstPageMethod() add attribute [System.Web.Service.WebMethod()]     II)MyFirstParameterPageMehtod() add attribute[System.web.Service.WebMethod()] 4)Call javascript function on input button callPagemethod use event onclick
script code
function  CallPageMethod()
{
debugger;
PageMethods.MyFirstPageMethod(onSucceeded,onFailed);

}
function  CallParametersPageMethod()
{
debugger;
PageMethods.MyFirstParameterPageMethod("This is a Demo",onSucceeded,onFailed);

}

function onSucceeded(result,userContext,methodName)
{
function CallPageMethod()
{;
$get('div1').innerText=result;
}
function onFailed(error,user)
{
debugger;
alert("An error occurred");
}
code behind code [System.Web.Services.WebMethod()] public static string MyFirstPageMethod() { return "Welcome to Ajaax"; }       [System.Web.Services.WebMethod()] public static string MyFirstParameterPageMethod(string sVal) { return "Welcome To ajax world value passed is" + sVal ; }

Reterving & assigning values of Server control using javascript

1)Create a function in javascript section of web page 2)Using document object call appropriate control id to retrive & assign value 3)Both control should be server control . 4)Call javascript function using Clientscript.RegisterStartupscript()
pseudo code Javascript function fun1() { //Assume one Dropdown & TextBox var s = document.getElementById("ddllist").Value;//or .innerText (to get all value in ddl) document.getElementById("txtUser").Value=s//or .innerText; } Server Side Code //call in any function of server side code ClientScript.RegisterScript(this.getType(),"key1","fun1",True);

Differencce between .net 2.0 ,3.0,3.5

.NET 2.0 CLR VERSION 2.0 FRMEWORK LIBRARIES : .NETfx 2.0 LANGUAGE : C# 2.0 VB 8.0 • A new hosting API for native applications wishing to host an instance of the .NET runtime • Full 64-bit support for both the x64 and the IA64 hardware platforms. • Language support for Generics built directly into the .NET CLR. • Many additional and improved ASP.NET web controls. • New data controls with declarative data binding. • New personalization features for ASP.NET, such as support for themes, skins and webparts. .NET 3.0 CLR VERSION 2.0 FRMEWORK LIBRARIES : .NETfx 3.0 LANGUAGE : C# 2.0 VB 8.0 • Windows Presentation Foundation (WPF), formerly code-named Avalon; a new user interface subsystem and API based on XML and vector graphics, which will make use of 3D computer graphics hardware and Direct3D technologies. • Windows Communication Foundation (WCF), formerly code-named Indigo; a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services. • Windows Workflow Foundation (WWF) allows for building of task automation and integrated transactions using workflows. • Windows CardSpace (WCS), formerly code-named InfoCard; a software component which securely stores a person's digital identities and provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website. .NET 3.5 CLR VERSION 2.0 FRMEWORK LIBRARIES : .NETfx 3.5 LANGUAGE : C# 3.0 VB 9.0 .NET 2.0 contains CLR.WINFORMS,ASPNET .NET 3.0 contains complete .net 2.o and WCF,WPF,WF,CARD SPACE .NET 3.5 contains complete .net 3.0 and LINQ , AJAX langauage integrty query (LINQ): it is microsoft .net framwork component adds data native querying capabilities to .net languages using systnax reminiscent of sql

Get Cursor position in Asp.net

1)Add Refernce of System.windows.form 2)using System.Windows.Form 3) Call Cursor object
puesdo code cursor.postion.x //To retrive x cordinate cusor.postion.y//To reterive y

Creating Folder in root or parent of Web application using asp.net

1)Using namespace System.io 2) create folder in root directory specify location in Server.mappath(".") assign variable to string variable (or) Create a folder in parent directory .use Server.mappath("..") assign varaiable to string variable .
(In web application folder suppose there are 2 folder i.e folder 2 is nest inside folder1 .I
want create another nest folder3 in folder1 .Folder 1 is parent folder )
3) Call a CreateDirectory method from Directory class specfy the path pseduo code(c# code) string path =Server.mappath("..") //reterive parent directory path Directory .createDirectory(path +"/Emplyoee" +"NewFolder") // here Employee is folder3 newfolder is nested inside Employeee nest folder of parent folder(web application folder)

Connecting Web parts using Filter in MOSS

step to connect web part Assume :Creation of list should known(list nothing but webpart in share point) 1)Click On the Site action Tab on the site and select Edit page 2)Add web part to desired location Right or Left 3)The web page dialogue is open select appropriate list or libaries web part Assume 2 list contain same colum in each list i)Employee list web part contain (eno) as one coloum ii)Employeedetails list web part contain (eno) as one coloum 4)Select this 2 approproiate web parts from the dialog 5)Select employeedetails webparts click on edit button right top corner of web parts 6)In popup window select connection tab -> select get sort/filter from popup-> ->select appropriate web part example employee web part 7) Configuration popup window is open ed select coloum in employee(primary web part) i.e (eno) coloum in employee eb part 8) Select (eno) Coloum from employeedetails (secondary web part or child) then click finish 9) Then Click on exit mode right top corner below web site action web part 10)You will see radio button left corner of a employee web part