By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,446 Members | 3,090 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,446 IT Pros & Developers. It's quick & easy.

Doing a javascript form.submit and triggering server side event code for button

P: n/a
Hi,

Can anyone help. This is really doing my nut in. 3 years ASP exp. and
now doing .DOT which is a step in the wrong direction.

Basically I am left with the code of a guy who has left. When I click a
button on a pop-up window the javascript for that button click does a
'button.form.submit'. On the Server side there is a Button click event
for this button, but for some reason it no longer fires. It worked fine
before and everything was checked into source safe.

Has anyone come across this problem or have any ideas? The event
handler is in 'Web Form Designer generated code' region.

How would you normally get this server side event to fire?

Thanks,

John.

Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
It's a bit difficult to debug this with such limited information. Post these
things.

0.) Does clicking the button actually POST back to the server ?
1.) The rendered HTML for this button ( The code behind the displayed page
in the browser )
2.) The declaration of the button in the code behind.
3.) The page directives at the top of the aspx source and its button
declaration.
4.) The event code for the button which is supposed to fire.

Then maybe we will have some chance of helping you.

--
Best Regards

The Inimitable Mr Newbie

"John Boy" <jo***********@lionbridge.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi,

Can anyone help. This is really doing my nut in. 3 years ASP exp. and
now doing .DOT which is a step in the wrong direction.

Basically I am left with the code of a guy who has left. When I click a
button on a pop-up window the javascript for that button click does a
'button.form.submit'. On the Server side there is a Button click event
for this button, but for some reason it no longer fires. It worked fine
before and everything was checked into source safe.

Has anyone come across this problem or have any ideas? The event
handler is in 'Web Form Designer generated code' region.

How would you normally get this server side event to fire?

Thanks,

John.

Nov 19 '05 #2

P: n/a
Apologies.

Before I continue. I am just learning ASP.net so let me know if
anything doesn't make sense. I did ASP for 3 years, but that was a good
while ago now and my mind is slowely decaying.

I have listed CLIENT and SERVER Side code below.

0) btnSearch is the button in question I click and no server side
onclick event is fired.
1) See Below
2) See Below
3) See Below
4) See Below

Let me know if you need anything else. Thanks for your help.

John.
CLIENT SIDE CODE:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title id="title">CM:Address:Search</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="../default.css" type="text/css" rel="stylesheet">
<LINK href="view.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<form name="frmView" method="post"
action="search.aspx?SourcePage=_dotnet_application s_ContactMaintenance_address_EditAddress_aspx_hygm oxaxq2420b45zvqrflvr&amp;ReturnHandler=btnLookupAd dress_Callback"
id="frmView">
<input type="hidden" name="__VIEWSTATE"
value="dDwxNDIwMTk1ODYzO3Q8cDxsPFZJRVdTVEFURV9TWVN URU1GSUxURVI7VkFMSURBVEVfUkVTVUxUU01PREU7PjtsPDtvP GY+Oz4+O2w8aTwxPjtpPDM+Oz47bDx0PHA8bDxpbm5lcmh0bWw 7PjtsPENNOkFkZHJlc3M6U2VhcmNoOz4+Ozs+O3Q8O2w8aTw3P jtpPDk+O2k8MTE+Oz47bDx0PHA8cDxsPFZpc2libGU7PjtsPG8 8Zj47Pj47PjtsPGk8MT47PjtsPHQ8QDA8Ozs7Ozs7Ozs7Oz47O z47Pj47dDxwPDtwPGw8b25jbGljazs+O2w8SmF2YVNjcmlwdDo gcmV0dXJuIGJ0blNlYXJjaF9PbkNsaWNrKHRoaXMpXDs7Pj4+O zs+O3Q8cDxwPGw8VmlzaWJsZTs+O2w8bzxmPjs+Pjs+Ozs+Oz4 +Oz4+O2w8Y2hrQWRkcmVzc1R5cGVzOjA7Y2hrQWRkcmVzc1R5c GVzOjE7Y2hrQWRkcmVzc1R5cGVzOjE7Pj5vwJZLNt0jMYE7oZ8 96kZx0Fl0FQ=="
/>
<script language="JavaScript" type="text/JavaScript">
<!--
function btnSearch_OnClick_Progress() {
if (document.all) {
var xMax = screen.width, yMax = screen.height;
} else {
if (document.layers) {
var xMax = window.outerWidth, yMax = window.outerHeight;
} else {
var xMax = 640, yMax=480;
}
}
var xOffset = (xMax/2) - (300/2);
var yOffset = (yMax/2) - (50/2);
var options = 'menubar=no,toolbar=no,scrollbars=no,';
options = options + 'height=50,width=300,screenX=' + xOffset +
',screenY=' + yOffset + ',top=' + yOffset + ',left=' + xOffset;
var w = window.open('../progress/progress.html',
'btnSearch_OnClick_Progress', options);
w.focus();}
// -->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function btnSearch_OnClick(button) {
btnSearch_OnClick_Progress();
button.form.submit();
}
// -->
</script>

<div id="page"><div id="header">CM : Address : Search</div><div
id="headerseparator"><table
width="100%"><tr><td></td></tr></table></div>
<div id="content">
<div id="pnlCriteria" class="DarkDataPanel">

<DIV class="field">
<DIV class="label">Address</DIV>
<input name="txtSearchAddress" type="text" maxlength="50"
size="50" id="txtSearchAddress" /><span
id="txtSearchAddress_ErrorImageSpan" style="visibility: hidden;"><span
id="txtSearchAddress_ErrorImage"></span></span></DIV>
<DIV class="checkfield">
<DIV class="label">Restrict to</DIV>
<span id="chkAddressTypes"><input id="chkAddressTypes_0"
type="checkbox" name="chkAddressTypes:0" /><label
for="chkAddressTypes_0">Service</label><input id="chkAddressTypes_1"
type="checkbox" name="chkAddressTypes:1" /><label
for="chkAddressTypes_1">Supply</label></span></DIV>
<DIV class="field">
<DIV class="label">Additional</DIV>
<input name="txtAdditionalData" type="text" maxlength="50"
size="50" id="txtAdditionalData" /><span
id="txtAdditionalData_ErrorImageSpan" style="visibility: hidden;"><span
id="txtAdditionalData_ErrorImage"></span></span></DIV>
<DIV class="optionfield">
<DIV class="label">Use additional data to search on?</DIV>
<span id="optAdditionalSearch"><input id="optAdditionalSearch_0"
type="radio" name="optAdditionalSearch" value="Service Number" /><label
for="optAdditionalSearch_0">Service Number</label><input
id="optAdditionalSearch_1" type="radio" name="optAdditionalSearch"
value="SAP Number" /><label for="optAdditionalSearch_1">SAP
Number</label><input id="optAdditionalSearch_2" type="radio"
name="optAdditionalSearch" value="None" checked="checked" /><label
for="optAdditionalSearch_2">None</label></span></DIV>

</div>

</div>
<div id="operations">
<input type="submit" name="btnSearch" value="Search"
id="btnSearch" onclick="javascript: return btnSearch_OnClick(this);" />

<input type="submit" name="btnClose" value="Close" id="btnClose"
/></div>
<div id="footer"><p>GSYELEC2K\op2104&nbsp;at&nbsp;09/11/2005
09:18:52</p><p>http:/ / pc446/ dotnet/ applications/
ContactMaintenance/ address/ search.aspx</p></div><div style='margin:
15px;'><table width='90%' border='1' style='font-size: 8pt; color:
#cccccc; border-collapse: collapse;'><tr><th align='left'
width='25%'>Key</th><th align='left' width='75%'>Value</th></tr><tr><td
align='left' width='20%'>ApplicationTitle</td><td align='left'
width='70%'>SaM</td></tr><tr><td align='left'
width='20%'>Context.SourcePage</td><td align='left'
width='70%'>_dotnet_applications_ContactMaintenanc e_address_EditAddress_aspx_hygmoxaxq2420b45zvqrflv r</td></tr><tr><td
align='left' width='20%'>Context.ReturnHandler</td><td align='left'
width='70%'>btnLookupAddress_Callback</td></tr><tr><td align='left'
width='20%'>Context.AddressID</td><td align='left'
width='70%'>0</td></tr><tr><td align='left'
width='20%'>Context.SourceApplication</td><td align='left'
width='70%'>CM</td></tr></table></div></div>
<script language="JavaScript" type="text/JavaScript">
<!--
function btnSearch_OnClick_Progress_Startup() {
var btnSearch_OnClick_ProgressWindow = window.open('',
'btnSearch_OnClick_Progress', 'height=1,width=1', false);
if (btnSearch_OnClick_ProgressWindow != null) {
btnSearch_OnClick_ProgressWindow.close();
}
}
btnSearch_OnClick_Progress_Startup();
// -->
</script>
</form>
</body>
</HTML>


SERVER SIDE CODE:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlTypes;

namespace ContactMaintenance.Address {
/// <summary>
/// Summary description for view.
/// </summary>
public class search :
gg.electricity.commoncontrols.Pages.HeaderFooterPa ge {

#region "EntryPoint"
/// <summary>
/// Just requires pop-up info
/// </summary>
public class EntryPoint: gg.electricity.EntryPoints.EntryPoint {

private gg.electricity.business.search.IFilter _SystemFilter;

///<summary>SystemFilter accessor method</summary>
[gg.electricity.EntryPoints.ContextParameter(true)]
public gg.electricity.business.search.IFilter SystemFilter {
get {
return _SystemFilter;
}
set {
_SystemFilter = value;
}
}

/// <summary>
/// </summary>
public EntryPoint(SqlString SourceApplication):
base(SourceApplication) {
}

/// <summary>
/// </summary>
public EntryPoint(SqlString SourceApplication,
gg.electricity.business.search.IFilter SystemFilter):
base(SourceApplication) {
_SystemFilter = SystemFilter;
}

/// <summary></summary>
public override int PopupHeight {
get {
return 650;
}
}

/// <summary></summary>
public override int PopupWidth {
get {
return 500;
}
}

public override string PopupName {
get {
return "ContactMaintenanceAddressSearch";
}
}

/// <summary>
///
/// </summary>
public override string PageURL {
get {
return "/address/search.aspx";
}
}

/// <summary>
///
/// </summary>
/// <returns></returns>
public override bool Validate() {
return (this.IsValidLookup);
}

/// <summary>
/// factory method wraps constructor with 0 parameters
/// </summary>
/// <returns></returns>
public static EntryPoint CreateForRetrieve() {
return new EntryPoint("UNSET");
}
}
#endregion

/// <summary></summary>
protected gg.electricity.commoncontrols.Button.Button btnSearch;

/// <summary></summary>
protected GEWEBCommonControls.GETextBox txtSearchAddress;

/// <summary></summary>
protected GEWEBCommonControls.GETextBox txtAdditionalData;

/// <summary></summary>
protected System.Web.UI.WebControls.CheckBoxList chkAddressTypes;

/// <summary></summary>
protected System.Web.UI.WebControls.RadioButtonList
optAdditionalSearch;

/// <summary></summary>
protected
gg.electricity.commoncontrols.DataGrid.EntryPointD ataGridReturn
grdSearchResults;

/// <summary></summary>
protected System.Web.UI.WebControls.Panel pnlCriteria;

/// <summary></summary>
protected System.Web.UI.WebControls.Panel pnlResults;

/// <summary></summary>
protected gg.electricity.commoncontrols.Button.Button btnSearchAgain;

/// <summary></summary>
protected gg.electricity.commoncontrols.Button.Button btnClose;

/// <summary></summary>
private EntryPoint entry;

/// <summary></summary>
private const string VIEWSTATE_MODE = "VALIDATE_RESULTSMODE";

/// <summary></summary>
private const string VIEWSTATE_SYSTEMFILTER =
"VIEWSTATE_SYSTEMFILTER";

/// <summary></summary>
private const string CACHE_SEARCHRESULTS = "CACHE_SEARCHRESULTS";

/// <summary></summary>
private const int CACHE_SEARCHRESULTS_TIMEOUT = 2;

/// <summary></summary>
private const string DATAGRID_FIELD_MANYCONTACTS = "{many}";

/// <summary></summary>
private const int DATAGRID_INDEX_ADDRESSID = 0;

/// <summary></summary>
private const int DATAGRID_INDEX_NAME = 1;

/// <summary></summary>
private const int DATAGRID_INDEX_ADDRESS = 2;

/// <summary></summary>
private const int DATAGRID_INDEX_DETAILS = 3;

/// <summary></summary>
private const int CHECK_INDEX_SERVICE = 0;

/// <summary></summary>
private const int CHECK_INDEX_SUPPLY = 1;

/// <summary></summary>
private const int OPTION_INDEX_SERVICENUMBER = 0;

/// <summary></summary>
private const int OPTION_INDEX_SAPNUMBER = 1;

/// <summary></summary>
private const int OPTION_INDEX_NONE = 2;
/// <summary></summary>
protected gg.electricity.commoncontrols.Headers.header header;
protected gg.electricity.commoncontrols.Headers.messages _Messages;

/// <summary></summary>
protected gg.electricity.commoncontrols.Footers.footer footer;

/// <summary></summary>
public override gg.electricity.commoncontrols.Headers.header _Header
{ get { return header; } }

/// <summary></summary>
public override gg.electricity.commoncontrols.Footers.footer _Footer
{ get { return null; } }
/// <summary></summary>
private void Page_Load(object sender, System.EventArgs e) {

// check which mode we are in
if (! this.IsPostBack) {
ResultsMode = false;

// read any criteria from context
this.RestoreSearchFilter();
}

// blank relevant controls
this._Messages.Error = "";

// make sure the datagrid doesnt fire the rowclick javascript when
// we click the detail buttons
this.grdSearchResults.ClientRowClickHandlerExcepti ons = new int[]
{DATAGRID_INDEX_DETAILS};

// handle the grids events
this.grdSearchResults.ItemDataBound += new
DataGridItemEventHandler(this.grdSearchResults_Ite mDataBound);
this.grdSearchResults.PageIndexChanged += new
DataGridPageChangedEventHandler(this.grdSearchResu lts_DataGridPageChanged);

// retrieve entry point
entry = EntryPoint.CreateForRetrieve();
try {
EntryPoint.Receive(this.Context, entry);
this.grdSearchResults.EntryPoint = entry;

// read our system filter into the viewstate version and clear the
// context version. ONLY ON FIRST LOAD - SUBSEQUENT ONES IT WILL BE
GONE
if (! this.IsPostBack) {
this.SystemFilter = entry.SystemFilter;
gg.electricity.Context.IContext c = new
gg.electricity.Context.SessionContext(this.Session );
c["Context.SystemFilter"] = null;
}

} catch (ArgumentException ex) {
this._Messages.Error = ex.Message;
return;
}

}

#region Web Form Designer generated code
/// <summary></summary>
override protected void OnInit(EventArgs e) {
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.grdSearchResults.RowClick += new
GEWEBCommonControls.GEDataGrid.RowClickEventHandle r(this.grdSearchResults_RowClick);
this.btnSearch.Click += new
System.EventHandler(this.btnSearch_Click);
this.btnSearchAgain.ConfirmClick += new
gg.electricity.commoncontrols.Button.Button.Confir mClickHandler(this.btnSearchAgain_ConfirmClick);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

/// <summary></summary>
protected gg.electricity.business.search.IFilter SystemFilter {
get {
if (this.ViewState[VIEWSTATE_SYSTEMFILTER] != null &&
this.ViewState[VIEWSTATE_SYSTEMFILTER].GetType() ==
typeof(gg.electricity.business.search.IFilter)) {
return
(gg.electricity.business.search.IFilter)this.ViewS tate[VIEWSTATE_SYSTEMFILTER];
} else {
this.ViewState[VIEWSTATE_SYSTEMFILTER] = false;
return null;
}
}
set {
this.ViewState[VIEWSTATE_SYSTEMFILTER] = value;
}
}

/// <summary></summary>
protected bool ResultsMode {
get {
if (this.ViewState[VIEWSTATE_MODE] != null) {
return (bool)this.ViewState[VIEWSTATE_MODE];
} else {
this.ViewState[VIEWSTATE_MODE] = false;
return false;
}
}
set {
this.ViewState[VIEWSTATE_SYSTEMFILTER] = null;
this.ViewState[VIEWSTATE_MODE] = value;
SetControls();
}
}

private void SetControls() {

this.pnlResults.Visible = ResultsMode;
this.btnSearchAgain.Visible = ResultsMode;

this.pnlCriteria.Visible = ! ResultsMode;
this.btnSearch.Visible = ! ResultsMode;

}

/// <summary>
/// Tries to find the search filter in context and restores the
controls
/// to that state
/// </summary>
private void RestoreSearchFilter() {

gg.electricity.Context.IContext c = new
gg.electricity.Context.SessionContext(Session);

if (c.Search.AddressFieldsSearch != null) {
gg.electricity.business.SearchFilters.AddressField s address =
(gg.electricity.business.SearchFilters.AddressFiel ds)c.Search.AddressFieldsSearch;
this.txtSearchAddress.Text = address.SearchText;
}

if (c.Search.AddressUsageSearch != null) {
gg.electricity.business.SearchFilters.AddressUsage addressusage =
(gg.electricity.business.SearchFilters.AddressUsag e)c.Search.AddressUsageSearch;
this.chkAddressTypes.Items[CHECK_INDEX_SERVICE].Selected =
addressusage.IsService;
this.chkAddressTypes.Items[CHECK_INDEX_SUPPLY].Selected =
addressusage.IsSupply;
}

if (c.Search.ServiceNumberSearch != null) {
gg.electricity.business.SearchFilters.ServiceNumbe r serviceno =
(gg.electricity.business.SearchFilters.ServiceNumb er)c.Search.ServiceNumberSearch;
this.txtAdditionalData.Text = serviceno.SearchText;
this.optAdditionalSearch.SelectedIndex =
OPTION_INDEX_SERVICENUMBER;
}

if (c.Search.SAPNumberSearch != null) {
gg.electricity.business.SearchFilters.SAPNumber sapno =
(gg.electricity.business.SearchFilters.SAPNumber)c .Search.SAPNumberSearch;
this.txtAdditionalData.Text = sapno.SearchText;
this.optAdditionalSearch.SelectedIndex = OPTION_INDEX_SAPNUMBER;
}
}

private gg.electricity.business.search.IFilter RetrieveSearchFilter()
{

// create context to store the data
gg.electricity.Context.IContext c = new
gg.electricity.Context.SessionContext(Session);

// create a filter for the search
gg.electricity.business.search.AndFilter filter = new
gg.electricity.business.search.AndFilter();

// add the initial address fields search
c.Search.AddressFieldsSearch = new
gg.electricity.business.SearchFilters.AddressField s(this.txtSearchAddress.Text.ToUpper());
filter.Add(c.Search.AddressFieldsSearch);

// add the requested types (unless they are all ticked)
c.Search.AddressUsageSearch = new
gg.electricity.business.SearchFilters.AddressUsage (this.chkAddressTypes.Items[CHECK_INDEX_SERVICE].Selected,

this.chkAddressTypes.Items[CHECK_INDEX_SUPPLY].Selected);
filter.Add(c.Search.AddressUsageSearch);

// add the appropriate additional data search
if (this.txtAdditionalData.Text.Trim().Length > 0) {
if (this.optAdditionalSearch.SelectedIndex ==
OPTION_INDEX_SERVICENUMBER) {
c.Search.ServiceNumberSearch = new
gg.electricity.business.SearchFilters.ServiceNumbe r(this.txtAdditionalData.Text);
filter.Add(c.Search.ServiceNumberSearch);

} else if (this.optAdditionalSearch.SelectedIndex ==
OPTION_INDEX_SAPNUMBER) {
c.Search.SAPNumberSearch = new
gg.electricity.business.SearchFilters.SAPNumber(th is.txtAdditionalData.Text);
filter.Add(c.Search.SAPNumberSearch);

} else {
// no need, None must be selected.
// DELETE ALL OF THE CONTEXT DATA
c.Search.ServiceNumberSearch = null;
c.Search.SAPNumberSearch = null;
}
}

// return the filter
return filter;
}

private void Search(bool useCache) {

// if we have criteria then run a search
if (this.txtSearchAddress.Text.Trim().Length > 0 ||
(this.txtAdditionalData.Text.Trim().Length > 0 &&
this.optAdditionalSearch.SelectedIndex != OPTION_INDEX_NONE
)) {

gg.electricity.business.Address.Addresses addresses = null;

// check for cached data
if (useCache) {
object data = this.Cache[this.ID + "." + CACHE_SEARCHRESULTS];
if (data != null) {
addresses = (gg.electricity.business.Address.Addresses)data;
}
}

// do the search (using a filter!)
if (addresses == null) {

// if we have a SystemFilter then append it to the user filter
gg.electricity.business.search.IFilter userFilter =
this.RetrieveSearchFilter();
if (this.SystemFilter != null) {
gg.electricity.business.search.AndFilter andFilter = new
gg.electricity.business.search.AndFilter();
andFilter.Add(userFilter);
andFilter.Add(this.SystemFilter);
userFilter = andFilter;
}
addresses =
gg.electricity.business.Address.Addresses.Search(u serFilter);

// set the data in cache
this.Cache.Insert(this.ID + "." + CACHE_SEARCHRESULTS,
addresses, null, DateTime.MaxValue , new TimeSpan(0, 0,
CACHE_SEARCHRESULTS_TIMEOUT, 0, 0),
System.Web.Caching.CacheItemPriority.Normal, null);
}

if (addresses.Count > 0) {

// bind data
this.grdSearchResults.DataSource = addresses;
this.grdSearchResults.DataBind();

// set mode
this.ResultsMode = true;

} else {
this._Messages.Message = "No matches were found.";
}

} else {
this._Messages.Error = "You must enter some search criteria.";
}
}

protected void btnSearch_Click(object sender, System.EventArgs e) {

this.Search(false);

}

/// <summary>
/// Set the text of grid-item to the single-row address
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private void grdSearchResults_ItemDataBound(object source,
DataGridItemEventArgs e) {
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem) {

// retrieve the address and bind its text
gg.electricity.business.Address.Address a =
(gg.electricity.business.Address.Address)e.Item.Da taItem;
e.Item.Cells[DATAGRID_INDEX_ADDRESS].Text =
a.FormatSingleLine.SingleLine;

// if there is a contact display their name
if (a.Contacts.Count == 1) {
e.Item.Cells[DATAGRID_INDEX_NAME].Text = a.Contacts[0].FullName;
} else if (a.Contacts.Count > 1) {
e.Item.Cells[DATAGRID_INDEX_NAME].Text = "{many}";
}

// create a popup button for viewing the items details
ContactMaintenance.Address.view.EntryPoint details = new
ContactMaintenance.Address.view.EntryPoint(a.Addre ssID,
entry.SourceApplication);
gg.electricity.commoncontrols.Button.EntryPointPop upButton lookup =
new gg.electricity.commoncontrols.Button.EntryPointPop upButton();
lookup.ID = "btnLookupAddressDetails" + a.AddressID.ToString();
lookup.Text = "Details";
lookup.EntryPoint = details;
lookup.SupressPostback = true;
e.Item.Cells[DATAGRID_INDEX_DETAILS].Controls.Add(lookup);
}
}

/// <summary></summary>
public override string PageTitle {
get { return "Search"; }
}

/// <summary></summary>
public override string ApplicationArea {
get { return "Address"; }
}

/// <summary>
/// make sure relevant scripts are registered even when the controls
are
/// hidden
/// </summary>
/// <param name="e"></param>
protected override void OnPreRender(EventArgs e) {
base.OnPreRender (e);
if (!
this.Page.IsStartupScriptRegistered(this.btnSearch .JavaScriptHideWindowScriptName))
{
this.Page.RegisterStartupScript(this.btnSearch.Jav aScriptHideWindowScriptName,
this.btnSearch.JavaScriptHideWindow(this.btnSearch .ClientID +
"_OnClick_Progress"));
}
}
private void grdSearchResults_DataGridPageChanged(object source,
DataGridPageChangedEventArgs e) {
this.grdSearchResults.CurrentPageIndex = e.NewPageIndex;
this.Search(true);
}

/// <summary></summary>
private void
btnSearchAgain_ConfirmClick(gg.electricity.commonc ontrols.Button.Button
source, ref bool success) {
this.ResultsMode = false;
}

private void grdSearchResults_RowClick(DataGridItem item) {
new gg.electricity.Context.SessionContext(Context.Sess ion).AddressID
= new SqlInt32(int.Parse(item.Cells[DATAGRID_INDEX_ADDRESSID].Text));
}

/// <summary></summary>
public override gg.electricity.EntryPoints.EntryPoint entrypoint {
get {
return entry;
}
}

}
}

Nov 19 '05 #3

P: n/a
This has now been resolved.

The base class Button.cs of the custom button 'btnSearch' has an
OnClick function which is fired (I didn't see this until two days after
my problem...great ehh). See Below:

protected override void OnClick(EventArgs e) {

base.OnClick(e);

bool success = true;
if (ConfirmClick != null) {
this.ConfirmClick(this, ref success);
}

if (success && this._CausePageClose) {
string closeScript = Utils.JavaScript.JavaScript.TagOpen();
closeScript += "this.close();" + Environment.NewLine;
closeScript += Utils.JavaScript.JavaScript.TagClose();

if (!this.Page.IsStartupScriptRegistered("close")) {
this.Page.RegisterStartupScript("close", closeScript);
}
}
}
The base.OnClick(e) line was removed so it basically stopped the click
event from firing by having ConfirmClick always equal to null.

John.

Nov 19 '05 #4

P: n/a
I just saw that a few minutes before your post

Well done !

--
Best Regards

The Inimitable Mr Newbie
"John Boy" <jo***********@lionbridge.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
This has now been resolved.

The base class Button.cs of the custom button 'btnSearch' has an
OnClick function which is fired (I didn't see this until two days after
my problem...great ehh). See Below:

protected override void OnClick(EventArgs e) {

base.OnClick(e);

bool success = true;
if (ConfirmClick != null) {
this.ConfirmClick(this, ref success);
}

if (success && this._CausePageClose) {
string closeScript = Utils.JavaScript.JavaScript.TagOpen();
closeScript += "this.close();" + Environment.NewLine;
closeScript += Utils.JavaScript.JavaScript.TagClose();

if (!this.Page.IsStartupScriptRegistered("close")) {
this.Page.RegisterStartupScript("close", closeScript);
}
}
}
The base.OnClick(e) line was removed so it basically stopped the click
event from firing by having ConfirmClick always equal to null.

John.

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.