Dot Net Learning Zone Blog

A blog about to learn Dot Net

Archive for the ‘ASP.net2.0’ Category

How to Pass Value from Parent to Child popup and Child popup to Parent in ASP.net

Posted by Rajesh on March 10, 2009

I have created two pages – Parent.aspx and Child.aspx

Parent.aspx:-

<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Parent.aspx.cs” Inherits=”_Default” %>

<!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>Untitled Page</title>

<script language=”javascript” type=”text/javascript”>
function OpenPopUP()
{
window.open (‘Child.aspx’,'Child’,'toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=320x,height=350px,top=200px,left=100px’);
return false;
}

</script>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<table>
<tr>
<td>
Name
</td>
<td>
<asp:TextBox ID=”txtName” runat=”server” Text=”"></asp:TextBox>
</td>
<td>
<asp:Button ID=”btnSearch” runat=”server” Text=”Search” OnClientClick=”OpenPopUP();” />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Child.aspx :-

<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Child.aspx.cs” Inherits=”Child” %>

<!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>Untitled Page</title>

<script language=”javascript” type=”text/javascript”>
function ValuePatentToChild()
{
var Name =  window.opener.document.forms[0].txtName.value;
var setName =  document.getElementById (‘txtChild’);
setName.value =  Name;

}

function ValueChildToParent()
{
var Name =  document.getElementById (‘txtChild’).value;
window.opener.document.forms[0].txtName.value =  Name;
self.close();
}

</script>

</head>
<body onload=”ValuePatentToChild();”>
<form id=”form1″ runat=”server”>
<div>
<table>
<tr>
<td>
<asp:TextBox ID=”txtChild” runat=”server” Text=”"></asp:TextBox>
</td>
<td>
<asp:Button ID=”btnClose” runat=”server” Text=”Close” OnClientClick=”ValueChildToParent();” />
</td>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Posted in ASP.net2.0, Ajax, Java Script | Leave a Comment »

How to create Web Setup Project in Visual studio 2005/2008

Posted by Rajesh on February 5, 2009

Steps:

1.      Create new ASP.NET Web Site

a.      File->Add New Web Site->, Select ASP.net Web Site from template  and choose location file type or http

2.      Right click on website and then add Web Deployment project (WebSite1_deploy”)

If Web Deployment project is not display in IDE then download from http://msdn.microsoft.com/en-us/asp.net/aa336619.aspx  for visual studio 2005 and  http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=0aa30ae8-c73b-4bdd-bb1b-fe697256c459&displaylang=en for visual studio 2008 .Install Web Deployment project and then restart your visual studio IDE. Then you can see Web Deployment project  in Build menu “Add Web Deployment Project”.

3.      Right click on WebSite1_deploy then click on Build

After successful build

4.      Add new web setup project in solution, assume project name is “WebSetup1”.Then right click on WebSetup1 and click on Add and select project output. In Project, select website1_deploy and then click on OK ..Now the final step is to build WebSetup1 .After successful build .msi file is created. Now you can install .msi file.

Posted in ASP.net2.0 | Leave a Comment »

access the data of Gridview in Rowcommand

Posted by Rajesh on August 11, 2008

Posted in ASP.net2.0 | Leave a Comment »

ASP.net 2.0 Question

Posted by Rajesh on August 11, 2007

1.1  Do I need IIS to run Web applications?   

  If you are using Visual Studio, you can use the ASP.NET Development Server built into Visual Studio to test your pages. The server functions as a local Web server, running ASP.NET Web pages in a manner virtually identical to how they run in IIS. To deploy a Web application, you need to copy it to a computer running IIS version 5 or 6.

1.2   How do I create pages for mobile devices?  

   ASP.NET will automatically detect the type of browser making the request. This information is used by the page and by individual controls to render appropriate markup for that browser. You therefore do not need to use a special set of pages or controls for mobile devices. (Whether you can design a single page to work with all types of browsers will depend on the page, on the browsers you want to target, and on your own goals.)

1.3 Are ASP.NET pages XHTML compatible? 

    Yes. Individual controls render markup that is compatible with the XHTML 1.1 standard. It is up to you, however, to include the appropriate document type declaration and other XHTML document elements. ASP.NET does not insert elements for you to ensure XHTML compatibility. For details, see ASP.NET and XHTML Compliance.

1.4 Can I hide the source code for my page?    

Server-side code is processed on the server and is not sent to the browser, so users cannot see it. However, client script is not protected; any client script that you add to your page, or that is injected into the page by server processing, is visible to users. If you are concerned about protecting your source code on the server, you can precompile your site and deploy the compiled version. For details, see Publishing Web Sites.

  1.5 When I run a page, I get the error “The page cannot be displayed” and an HTTP 502 Proxy Error. Why?

     This error can occur if you are running ASP.NET Web pages using the Visual Web Developer Web server, because the URL includes a randomly selected port number. Proxy servers do not recognize the URL and return this error. To get around the problem, change your settings in Internet Explorer to bypass the proxy server for local addresses, so that the request is not sent to the proxy. In Internet Explorer, you can make this change in Tools > Internet Options. In the Connections tab, click LAN Settings and then select Bypass proxy server for local addresses.

1.6 Which page code model is preferable, single-file or code-behind?    

Both models function the same and have the same performance. The choice of using single-file pages versus code-behind pages is one of personal preference and convenience. For details, see ASP.NET Web Page Code Model.The QuickStart examples and examples in the API reference seem to use single-file pages frequently. Does this mean that single-file is the preferred model for pages? No. Single-file pages are frequently used in examples because they are easier to illustrate — the writer does not have to create a separate file to show the code. 

1.7 Is it better to write code in C# or Visual Basic?    

You can write code for your Web application in any language supported by the .NET Framework. That includes Visual Basic, C#, J#, JScript, and others. Although the languages have different syntax, they all compile to the same object code. The languages have small differences in how they support different features. For example, C# provides access to unmanaged code, while Visual Basic supports implicit event binding via the Handles clause. However, the differences are minor, and unless your requirements involve one of these small differences, the choice of programming language is one of personal preference. Once programs are compiled, they all perform identically; that is, Visual Basic programs run just as fast as C# programs, since they both produce the same object code.

1.8 Do I have to use one programming language for all my Web pages?    

No. Each page can be written in a different programming language if you want, even in the same application. If you are creating source code files and putting them in the \App_Code folder to be compiled at run time, all the code in must be in the same language. However, you can create subfolders in the \App_Code folder and use the subfolders to store components written in different programming languages.

 1.9 Is the code in single-file and code-behind pages identical?  

   Almost. A code-behind file contains an explicit class declaration, which is not required for single-file pages.

 1.10 Is the old code-behind model still supported? 

   Old projects will continue to run without change. In Visual Studio 2005, if you open a project created in Visual Studio .NET 2002 or 2003, by default, the project is converted to the new project layout used in Visual Studio 2005. As part of the conversion, pages that use the old code-behind model are converted to use the new code-behind model. Visual Studio 2005 Web Application Projects provide an alternative web project model that uses the same project, build and compilation semantics as the Visual Studio .NET 2003 code-behind model. For details, see Visual Studio 2005 Web Application Projects.

Posted in ASP.net2.0 | Leave a Comment »

New Features inASP.net 2.0

Posted by Rajesh on August 4, 2007

Posted in ASP.net2.0 | Leave a Comment »