Response.End()

Response End

This is added after the text needed in the response stream is written using the Response.Write() so no other html or garbage is written in the response stream.

Without response.end() javascript will have the text and the remaining garbage.

[ex. 1] without response.end()

Response.Write(“err”);
…..
result =”err

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml&#8221; ><head><link href=”../App_Themes/Default/Content.css” type=”text/css” rel=”stylesheet” /><link href=”../App_Themes/Default/Default.css” type=”text/css” rel=”stylesheet” /><link href=”../App_Themes/Default/EmailSender.css” type=”text/css” rel=”stylesheet” /><link href=”../App_Themes/Default/Header.css” type=”text/css” rel=”stylesheet” /><link href=”../App_Themes/Default/Header2.css” type=”text/css” rel=”stylesheet” /><link href=”../App_Themes/Default/Sidebar.css” type=”text/css” rel=”stylesheet” /><title> </title></head><body>    <form name=”form1″ method=”post” action=”WebService.aspx” id=”form1″><div><input type=”hidden” name=”__VIEWSTATE” id=”__VIEWSTATE” value=”/wEPZwUPOGNjY2JiNjJiNWQ5MDI41In2qlnOWzD0wbpAPF80y1dPYTA=” /></div>
</form></body></html>” Read the rest of this entry »

Advertisements

Reference Controls from MasterPage

To reference controls from a master page in a normal page use the following syntax:

Ex. Reference the Head Html tag of the Master Page from a normal page to add scripts in the head. Set the Head as runat=”server” and give id=”Head”, then enter the following syntax:

HtmlHead headTag = ((HtmlHead)((MasterPageName)this.Master).FindControl(“Head”));

Hope this helps. Btw this will mostly be used in Visual Studio 2005 since in the new versions, you can add an ContentPlaceHolder in the Head tag of the Master page and insert any scripts in the PlaceHolder on the page