| Topics |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Tech Feeds |
|
|
|
|
|
|
|
|
|
| Tech Fun |
|
|
|
|
|
|
|
|
Aamir Hasan Blog |
External JavaScript added by ScriptManager.RegisterStartupScript executes Actually, the page does execute the entire page lifecycle on
asynchronous postbacks.
However, the cause of the problem is that basically, once the
script is registered on the page, it cannot be registered again. That
is why using ScriptManager.RegisterStartupScript,
ClientScript.RegisterStartupScript, and Page.RegisterStartupScript will
only call the javascript on the initial load. It's like writing <script type="text/javascript" src="JavaScript.js" /> over and
over in your document.
What you need to do, is clear the script element from the page,
so that it can be readded upon asynchronous postbacks. Add the
following on your page (changing the filename & path accordingly): <asp:ScriptManager ID="ScriptManager1" runat="server" /> <script type="text/javascript"> var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_pageLoaded(PageLoadedHandler);
function PageLoadedHandler(sender, args) { var allScriptTags = document.getElementsByTagName("script"); for (i = allScriptTags.length; i >= 0; i--) { if (allScriptTags[i] && allScriptTags[i].getAttribute("src")!=null && allScriptTags[i].getAttribute("src").indexOf("JScript.js") != -1) { allScriptTags[i].parentNode.removeChild(allScriptTags[i]); } } } </script> Then place this in your Page_Load event (again changing
the filename and path to what you need): Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ScriptManager.RegisterStartupScript(Page, Page.GetType, "", "<script type='text/javascript' src='JScript.js' />", False) End Sub
 Wed, 03 Mar 2010 03:59:00 GMT Read More >>PHP for Microsoft AJAX Library Author: Aamir Hasan
PHP updated support for
Microsoft AJAX Library. It works with the RTM bits, and fixes several of
the issues reported in my earlier samples. , so that you can join in and contribute to the
project.The Microsoft AJAX Library is a standalone collection of the
standards-based JavaScript classes included in Microsoft ASP.NET AJAX. it simply supports exposing PHP classes as AJAX-enabled web services,
just as in ASP.NET applications. In fact, the generated proxies are
identical to what you get from ASP.NET Test Example <?php
require_once '../../dist/MSAjaxService.php';
class TestService extends MSAjaxService { function SayHello($name) { return 'Welcome, ' . $name . '!'; } }
$h = new HelloService(); $h->ProcessRequest();
?> Index.html <html> <head> <title>Hello, World!</title> <script type="text/javascript" src="../../MicrosoftAjaxLibrary/MicrosoftAjax.js"></script> <script type="text/javascript" src="HelloService.php/js"></script> </head> <body> Name: <input id="name" type="text" /> <input type="button" value="Say Hello" onclick="button_click(); return false;" /> <br /> Response from server: <span id="response"></span> </body> <script type="text/javascript"> function button_click() { TestService.SayHello($get('name').value, function (result) { $get('response').innerHTML = result; }); } </script> </html> Oh, and if you are interest in PHP, you might want to check out the FastCGI work on IIS to make PHP rock on IIS7. Link:PHP for Microsoft AJAX Library
 Sun, 21 Feb 2010 12:28:00 GMT Read More >>Setting bootup Operating System for Windows Vista and windows XP Author: Aamir Hasan
Windows Vista and Windows XP is install on same machine then you have new boot loader for windows Vista and it is not using NTLDR/BOOT.ini when u access this machine where both windows are installed on same machine and you will access remote desktop then default order from cmd u have to define are follows.
From Windows XP
Navigate (cd) to
Windows Vista Windows\System32 and issue >bcdedit to know the
identifier of installed OS. Note the OS guid and then issue >bcdedit
/default {guid}
From Windows Vista
First
open up the command prompt under Administrator account using >runas
/user:Administrator. From there issue >bcdedit and >bcdedit
/default
- If "Run" is missing from Vista's
Start Menu, right click the taskbar, choose Properties, from "Start
Menu" > "Customize", check "Run Command"
- >shutdown –r
can be used to restart the Windows (both XP and Vista)
 Sun, 21 Feb 2010 08:04:00 GMT Read More >>Display row# in gridview How to display row# in gridview, DataGrid,Repeater or DataListGridView is one of most widely used controls and we can do lots of things with the control.
In ASP.Net 2.0, Datagrid is replaced by GridView control while Datagrid control is still supported. There are large numbers of tasks that can be done through grid view control.
<%@ Page Language="C#"%> <script runat="server">
protectedvoid Page_Load(object sender, EventArgs e) { gridView1.DataSource =newstring[] { "Aamir Hasan", "www.studentacad.com", "aspxtutorial.com" }; gridView1.DataBind(); } </script> <html> <head runat="server"> <title>GridView Row number's</title> </head> <body> <form id="form2" runat="server"> <div> <asp:GridView runat="server" ID="gridView1"> <Columns> <asp:TemplateField HeaderText="#"> <ItemTemplate> <%# Container.DataItemIndex + 1 %> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </div> </form> </body> </html> Links GridViewRow GridView Row
 Fri, 19 Feb 2010 17:31:00 GMT Read More >>LINQ to SQL Application Performance SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
Turn off ObjectTrackingEnabled Property of Data Context If Not Necessary using (NorthwindDataContext context = new NorthwindDataContext()) { context.ObjectTrackingEnabled = false; }
- Do NOT Dump All Your DB Objects into One Single Data Context
- Use Compiled Query Wherever Needed
- Filter Data Down to What You Need Using DataLoadOptions.AssociateWith
- Turn Optimistic Concurrency Off Unless You Need It
- Constantly Monitor Queries Generated by the Data Context and Analyze the Data You Retrieve
- Avoid Unnecessary Attaches to Tables in the Context
- Be Careful of Entity Identity Management Overhead
- Retrieve Only the Number of Records You Need
- Do not Misuse Compiled Query
public static Func<Northwnd, string, IQueryable<Customer>> CustomersByCity = CompiledQuery.Compile((Northwnd db, string city) => from c in db.Customers where c.City == city select c);
public static Func<Northwnd, string, IQueryable<Customer>> CustomersById = CompiledQuery.Compile((Northwnd db, string id) => db.Customers.Where(c => c.CustomerID == id));
public IEnumerable<Customer> GetCustomersByCity(string city) { var myDb = GetNorthwind(); return Queries.CustomersByCity(myDb, city); } Reference:http://msdn.microsoft.com/en-us/library/system.data.linq.compiledquery.aspx
 Wed, 17 Feb 2010 13:54:00 GMT Read More >> | | | |