|
-
Aug 26th, 2004, 12:42 PM
#1
Thread Starter
Frenzied Member
__doPostBack() not on page [Resolved]
ASP.Net has stopped putting the javascript it uses to raise events off all my pages.......
why does ASP.Net hate me...?
I have two Page class between myself and the original UI.Page class. I am calling bas.OnLoad(e) in each of these classes so the page load should be reached no problem.......
PHP Code:
public class Page : System.Web.UI.Page
{
protected internal bool _useSessionViewState = false;
/// <summary>
/// Save ViewState.
/// </summary>
/// <param name="viewState">The ViewState.</param>
protected override void SavePageStateToPersistenceMedium(object viewState)
{
if(_useSessionViewState)
{
this.Session[this.Request.Path + "-vstate"] = viewState;
}
else
{
base.SavePageStateToPersistenceMedium(viewState);
}
}
/// <summary>
/// Load ViewState.
/// </summary>
/// <returns>The ViewState.</returns>
protected override object LoadPageStateFromPersistenceMedium()
{
if(_useSessionViewState)
{
if(this.Session[this.Request.Path + "-vstate"] == null)
{
this.Response.Redirect(this.Request.ApplicationPath);
}
return this.Session[this.Request.Path + "-vstate"];
}
else
{
return base.LoadPageStateFromPersistenceMedium();
}
}
/// <summary>
/// Fires when a page is loaded.
/// </summary>
/// <param name="e">In passed Event Arguments.</param>
protected override void OnLoad(System.EventArgs e)
{
//add quick post back command handler
Page.RegisterClientScriptBlock("-exPostBackCommandHandler", Helpers.Read.ResourceString("PKPromo.Web.JavaScript.PostBackHandler.js"));
//add basic cross browser dhtml functions
Page.RegisterClientScriptBlock("-exDHTML-API", Helpers.Read.ResourceString("PKPromo.Web.JavaScript.DHTML-API.js"));
//add popup window js
Page.RegisterClientScriptBlock("-exDPopUp", Helpers.Read.ResourceString("PKPromo.Web.JavaScript.Popup.js"));
//init dhtml scripting
Page.RegisterStartupScript("-exInitDHTML-API", "<script language=\"JavaScript\">pk_InitializeDHTMLLib();</script>");
System.Text.StringBuilder sbld = new System.Text.StringBuilder();
string ticker = "";
sbld.Append("<script language=\"JavaScript\">\r\n");
sbld.Append(" var ___tickMessage = \"PK Promotions ~ Custom Importing and Exporting.\";\r\n");
sbld.Append(" window.defaultStatus = ___tickMessage;\r\n");
sbld.Append(" //setInterval(\"if(window.status != ___tickMessage){window.status = ___tickMessage;}\", 5);//window.status = __tickCache;\r\n");
sbld.Append("</script>\r\n");
ticker = sbld.ToString();
Page.RegisterClientScriptBlock("-statusTicker", ticker);
sbld = null;
//Proccess PostBack Commands Raised from client script
if(Request["__EVENTTARGET"] == "PostBackCommand" && Request["__EVENTARGUMENT"] != null && IsPostBack)
{PostBackCommand(Request["__EVENTARGUMENT"]);}
//write signutare
Response.Write("<!-- /***************************************************************");
Response.Write("\r\n");
Response.Write(" *");
Response.Write("\r\n");
Response.Write(" * [url]http://www.pkpromo.com[/url]");
Response.Write("\r\n");
Response.Write(" *");
Response.Write("\r\n");
Response.Write(" * Development and Design:");
Response.Write("\r\n");
Response.Write(" * Ezekiel Naulty [[email protected]]");
Response.Write("\r\n");
Response.Write(" * And");
Response.Write("\r\n");
Response.Write(" * Gabriel Martin [[email protected]]");
Response.Write("\r\n");
Response.Write(" *");
Response.Write("\r\n");
Response.Write(" * Project Began: April 2004");
Response.Write("\r\n");
Response.Write(" * Project Last Updated: August 2004");
Response.Write("\r\n");
Response.Write(" *");
Response.Write("\r\n");
Response.Write(" ************************************************/ -->");
Response.Write("\r\n");
base.OnLoad(e);
}
/// <summary>
///
/// </summary>
/// <param name="command"></param>
protected virtual void PostBackCommand(string command){}
}
PHP Code:
public class User : Page
{
/// <summary>
///
/// </summary>
/// <param name="e"></param>
new protected virtual void OnLoad(System.EventArgs e)
{
if(!((PKPromo.Business.Contacts.Security.LoginResults)Session["-login"]).IsAllowed){this.Response.Redirect(this.Request.ApplicationPath);}
base.OnLoad(e);
}
Last edited by Magiaus; Aug 26th, 2004 at 01:21 PM.
Magiaus
If I helped give me some points.
-
Aug 26th, 2004, 12:54 PM
#2
Thread Starter
Frenzied Member
It does everything like it should for my pages and makes this script.....
Code:
<script language="javascript">
<!--//
function pbCommand(cmd)
{
__doPostBack('PostBackCommand', cmd);
}
//-->
</script>
<script language="JavaScript">
// Global variables
var intited = false;
var isCSS;
var isW3C;
var isIE4;
var isNN4;
var isNN6;
var isIE6CSS;
// Initialize upon load to let all browsers establish content objects
function pk_InitializeDHTMLLib() {
if(intited == true){return;}
if (document.images) {
isCSS = (document.body && document.body.style) ? true : false;
isW3C = (isCSS && document.getElementById) ? true : false;
isIE4 = (isCSS && document.all) ? true : false;
isNN4 = (document.layers) ? true : false;
isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
intited = true;
}
}
//Seek Nested Netscape 4 Layer
function pk_SeekLayer(doc, name)
{
if(intited == false){pk_InitializeDHTMLLib()}
var obj;
for(var i = 0; i < doc.layers.length; i++)
{
if(doc.layers[i].name == name)
{
obj = doc.layers[i]
break;
}
if(doc.layers[i].document.layers.length > 0)
{ //recrusive
obj = pk_SeekLayer(document.layers[i].document, name);
}
}
return obj;
}
//Convert object name string or object refreance
//into a valid element object refreance
function pk_GetObject(obj)
{
if(intited == false){pk_InitializeDHTMLLib()}
if(typeof obj == "string")
{
if(isW3C)
{
return document.getElementById(obj);
}
else if(isIE4)
{
return document.all(obj);
}
else if(isNN4)
{
return pk_SeekLayer(document, obj);
}
}
else
{
return obj;
}
}
//Position an object at a specific pixel coordinate
function pk_MoveTo(obj, x, y)
{
obj = pk_GetObject(obj);
if(obj)
{
if(isCSS)
{
var units = (typeof(obj.left == "string") ? "px" : 0);
obj.left = x + units;
obj.top = y + units;
}
else if(isNN4)
{
obj.moveTo(x, y);
}
}
}
//Move an object by an x y offset
function pk_MoveBy(obj, x, y)
{
obj = pk_GetObject(obj);
if(obj)
{
if(isCSS)
{
var units = (typeof(obj.left == "string") ? "px" : 0);
obj.left = pk_GetObejectLeft(obj) + x + units;
obj.top = pk_GetObjectTop(obj) + y + units;
}
else if(isNN4)
{
obj.moveBy(x, y);
}
}
}
//set an object's z-index
function pk_SetZ(obj, z)
{
obj = pk_GetObject(obj);
if(obj)
{
obj.zIndex = z;
}
}
//change an object's bgcolor
function pk_SetBgColor(obj, html_color)
{
obj = pk_GetObject(obj);
if(obj)
{
if(isNN4)
{
obj.bgColor = html_color;
}
else if(isCSS)
{
obj.backgroundColor = html_color;
}
}
}
//make an object visible
function pk_Show(obj)
{
obj = pk_GetObject(obj);
if(obj)
{
obj.visibility = "visible";
}
}
//make an object invisible
function pk_Hide(obj)
{
obj = pk_GetObject(obj);
if(obj)
{
obj.visibility = "hidden";
}
}
function pk_Collapse(obj)
{
obj = pk_GetObject(obj);
if(obj)
{
obj.display = "none";
}
}
function pk_Expand(obj)
{
obj = pk_GetObject(obj);
if(obj)
{
obj.display = "block";
}
}
function pk_GetObjectLeft(obj)
{
obj = pk_GetObject(obj);
var ret = 0;
if(document.defaultView)
{
var style = document.defaultView;
var cssDec = style.getComputedStyle(obj, "");
ret = cssDec.getPropertyValue("left");
}
else if(obj.currentStyle.left)
{
ret = obj.currentStyle.left;
}
else if(obj.style)
{
ret = obj.style.left;
}
else if(isNN4)
{
ret = obj.left;
}
return parseInt(ret);
}
function pk_GetObjectTop(obj)
{
obj = pk_GetObject(obj);
var ret = 0;
if(document.defaultView)
{
var style = document.defaultView;
var cssDec = style.getComputedStyle(obj, "");
ret = cssDec.getPropertyValue("top");
}
else if(obj.currentStyle.top)
{
ret = obj.currentStyle.top;
}
else if(obj.style)
{
ret = obj.style.top;
}
else if(isNN4)
{
ret = obj.top;
}
return parseInt(ret);
}
function pk_GetObjectWidth(obj)
{
obj = pk_GetObject(obj);
var ret = 0;
if(obj.offsetWidth)
{
ret = obj.offsetWidth;
}
else if(obj.clip && obj.clip.width)
{
ret = obj.clip.width;
}
else if(obj.style && obj.style.pixelWidth)
{
ret = obj.style.pixelWidth;
}
return parseInt(ret);
}
function pk_GetObjectHeight(obj)
{
obj = pk_GetObject(obj);
var ret = 0;
if(obj.offsetWidth)
{
ret = obj.offsetHeight;
}
else if(obj.clip && obj.clip.height)
{
ret = obj.clip.height;
}
else if(obj.style && obj.style.pixelHeight)
{
ret = obj.style.pixelHeight;
}
return parseInt(ret);
}
</script>
<script language="JavaScript">
function pk_popup(name, url)
{
//var sw = ((screen.width - 640) / 2);
//var sh = ((screen.height - 480 / 2);
//var features = "width=640,height=480";//,left=" + sw + ",top=" + sh;
window.open(url, name, "width=640,height=480,scrollbars=1");
}
function pk_popupSizable(name, url)
{
//var sw = ((screen.width - 640) / 2);
//var sh = ((screen.height - 480 / 2);
//var features = "width=640,height=480";//,left=" + sw + ",top=" + sh;
window.open(url, name, "width=800,height=650,resizable=1,scrollbars=1");
}
</script>
<script language="JavaScript">
var ___tickMessage = "PK Promotions ~ Custom Importing and Exporting.";
window.defaultStatus = ___tickMessage;
//setInterval("if(window.status != ___tickMessage){window.status = ___tickMessage;}", 5);//window.status = __tickCache;
</script>
but it is not putting in the __doPostBack() method used by the framework.........
Magiaus
If I helped give me some points.
-
Aug 26th, 2004, 01:20 PM
#3
Thread Starter
Frenzied Member
i had to add this
PHP Code:
internal System.Web.UI.WebControls.LinkButton pk_dummyLinks67dgh8sd4gbx8c48hsd97b4x8cv = new System.Web.UI.WebControls.LinkButton();
Page.GetPostBackClientEvent(pk_dummyLinks67dgh8sd4gbx8c48hsd97b4x8cv,"");
ASP.Net doesn't waste time bandwidth on that __doPostBack() unless it says I need it. I talked with it about dumb bs and it said oh well I guess if you lie to me I'll work with you.....
Code:
<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
theform = document.forms["Form1"];
}
else {
theform = document.Form1;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
that is such a waste of bandwidth.......
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|