<%@ Import Namespace="System.Threading" %>
Use inline when no public partial class MyCompanies : System.Web.UI.Page class definition in a CodeFile/CodeBehind
<%@ Page Language="C#" Title="EzPL8 - Relate by Plate: Investigate, Date, Communicate" uiculture="auto" EnableViewState="false" EnableSessionState="False" MasterPageFile="~/Site.master"%>
<%@ Import Namespace="System.Threading" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Collections.Generic" %>
The difference between the two:
Behind leaves the source behind: it's compiled, with the DLL placed in the bin folder .
File is the source --for a partial class
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyCompanies.aspx.cs" Inherits="MyCompanies" EnableEventValidation="false" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<script runat="server">
In the MyCompanies.aspx.cs file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
public partial class MyCompanies : System.Web.UI.Page
{
bool FilterSearch = false;
bool FilterCategory = false;
// get elementID for jQuery autocomplete lookup
protected string GetClientIDforCoID() { return this.dvAccount.FindControl("CoID").ClientID.ToString(); }
// getElementId from DetailsView for jQuery autocomplete lookup
// from a PageMethod; XML or JSON from .asmx/.svc; or JSONP from your own.ashx
// or other web services provider.
protected string GetClientIDforCompany() {
if (this.dvAccount.FindControl("Company") != null)
return this.dvAccount.FindControl("Company").ClientID.ToString();
else return string.Empty;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!Context.User.Identity.IsAuthenticated)
Server.Transfer("~/Account/Login.aspx?ReturnURL=..%2fCompanies.aspx");
//omb.Hide(); do this in gvAccounts DataBound
//dvAccount.Visible = false; //replaceme do this in gvAccounts DataBound
}
}
}