Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   .NET (https://www.clubdelphi.com/foros/forumdisplay.php?f=17)
-   -   Utiles JavaScript para proyectos ASP.NET con ECO (https://www.clubdelphi.com/foros/showthread.php?t=42825)

mariosaurio 24-04-2007 02:31:49

Utiles JavaScript para proyectos ASP.NET con ECO
 
Otro aporte.

http://www.terawiki.clubdelphi.com/a...JavaScript.zip

Aqui encontran funciones muy utililes a la hora de diseñar proyecto ASP.NET con ECO.

Solo hagan referencia al archivo JAVASCRIPT.PAS en cada pagina que realicen y listo.

Detallo las funciones que dispone.


// métodos que escriben pequeño comandos
class procedure WriteStartScript(Code: StringBuilder);static;
class procedure WriteStartFunction(Name: String; Code: StringBuilder; Parameters: string = '');static;
class procedure WriteEndScript(Code: StringBuilder);static;
class procedure WriteEndFunction(Code: StringBuilder);static;
class procedure WriteConfirm(Question: String; Code: StringBuilder);static;
class procedure WriteAlert(Information: String; Code: StringBuilder);static;
class procedure WriteRedirect(ToPage: String; Code: StringBuilder);static;

// métodos que escrebe funciones complejas
class procedure SetFocus( AOwner : System.Web.UI.Page; const AWebControls : WebControl; const ARegister : Boolean);static;
class procedure ShowMessage( AOwner : System.Web.UI.Page; const AMessage : String; const ARegister : Boolean);static;
class procedure ShowMessageAndRedirect( AOwner : System.Web.UI.Page; const Information, ToPage: String; const ARegister : Boolean);static;
class procedure ConfirmAndRedirect(AOwner: System.Web.UI.Page;Question, RedirectTo: String);static;
class procedure OpenWindow(AOwner: System.Web.UI.Page);static;
class procedure SetVisibility(AOwner: System.Web.UI.Page);static;
class procedure InvertVisibility(AOwner: System.Web.UI.Page);static;

// métodos de registro de script
class procedure RegisterStartupScript(AOwner : System.Web.UI.Page; Key: String; Code: StringBuilder);static;
class procedure RegisterClientScript(AOwner : System.Web.UI.Page; Key: String; Code: StringBuilder);static;

class function HTMLEncode( s : String ) : String;static;
class procedure ClickSaveConfirm( Sender : WebControl);static;
class procedure ClickDeleteConfirm( Sender : WebControl);static;
class procedure ClickConfirm( Sender : WebControl; const msg : String);static;
class procedure ClickOpenNewWindow( Sender : WebControl; const URL : String);static;
class procedure RegisterOnKeyDownButton(Sender: System.Web.UI.Control; Btn: System.Web.UI.WebControls.Button); static;
class procedure GoAnchor( AOwner : Page;
const anchor : String; const ARegister: Boolean);static;
class procedure AbrirVentana(AOwner: System.Web.UI.Page;const URL:String);static;
class procedure SetInitialFocus(c:Control);static;
class procedure SetInitialFocusSelect(c:Control);static;
Class Procedure SetAttributes(Page:control);static;
class procedure HabilitarEnterScript(p:page);static;
Class Procedure DesabilitarBotones(Page:control);static;
Class Procedure HabilitarBotones(Page:control);static;
Class Procedure HabilitarCajasTexto(Page:control);static;
Class Procedure DesabilitarCajasTexto(Page:control);static;



Por ejemplo yo aplico la funcion de de TAB por ENTER que es muy util a la hora de introducir informacion en un formulario. ejemplo.




procedure TWFEdicionControlMensual.Page_Load(sender: System.Object; e: System.EventArgs);
var
Id: string;
begin
EcoSpace.Active := True;
Id := Request.Params['RootId'];
if Assigned(Id) and (Id <> '') then
begin
rhRoot.SetElement(ObjectForId(Id));
if not IsPostBack then
begin
if (rhRoot.Element.AsObject as ControlMensual).Zona<>nil then
ddlZona.SelectedValue:=(rhRoot.Element.AsObject as ControlMensual).Zona.sNombre;

end;
end;
if not IsPostBack then
DataBind;
// TODO: Put user code to initialize the page here
if not IsPostBack then
begin
TJavaScript.HabilitarEnterScript(Page);
TJavaScript.ClickSaveConfirm(btnGrabar);
TJavaScript.ClickDeleteConfirm(btnEliminar);
TJavaScript.SetInitialFocus(txtFactorReposicion);
// TJavaScript.SetAttributes(Page);
end;
TJavaScript.SetAttributes(Page);

end;


Espero que les sirva de algo.

Mariosaurio

pablito373 25-10-2007 00:24:29

No puedo descargar el archivo
 
Hola, no puedo descargar el archivo y la verdad me seria de utilidad el codigo javascript encapsulado asi....

Me lo puedes enviar???


La franja horaria es GMT +2. Ahora son las 01:44:56.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi