We're using .NET 2.0, VB. I expect a .Click event handler to be called, but it's not.
When I click on the webpage link named btnSearch, the confirmSearchOK() javascipt function is called(I see this when I uncomment the alert() ), which contains the __doPostBack() call. On the .VB side, the handler never gets called. BTW, the handler was created by double-clicking on the .ASPX object in the 'Design' mode.
Any help would be appreciated.
Thanks
Javascipt: -
function confirmSearchOK() {
-
var planSel = document.getElementById("<%= ddlPlanID.ClientID %>").selectedIndex;
-
var opSel = document.getElementById("<%= ddlOfferingPeriod.ClientID %>").selectedIndex;
-
var useEASi = document.getElementById("<%= hUseEASi.ClientID %>").value;
-
var epError = 0
-
-
if( useEASi == 'Y'){
-
if (document.getElementById("<%= ddlEnrollmentPeriod.ClientID %>").selectedIndex == 0)
-
epError = 1;
-
}
-
-
//alert("planSel: "+planSel+", opSel: "+opSel+", useEASi: "+useEASi+", epError: "+epError );
-
-
if( planSel == 0 )
-
alert("Error, must choose a Plan prior to Search");
-
else if( opSel == 0 )
-
alert("Error, must choose an Offering Period prior to Search");
-
else if( epError == 1 )
-
alert("Error, must choose an Enrollment Period prior to Search");
-
else
-
__doPostBack('btnSearch','');
-
}
-
asp.net -
<td align="left" class="FormFieldCell" colspan="3" style="white-space: nowrap">
-
<EASI:LinkButton ID="btnSearch" runat="server" CausesValidation="False" ClientScript="confirmSearchOK();" UseSecurityLevel="True">Search</EASI:LinkButton></td>
VB.NET event handler - Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
-
-
'handle the event here
-
-
End Sub
-
1 1902 Frinavale 9,735
Recognized Expert Moderator Expert
What is an "EASI" LinkButton?
Why don't you just use an ASP.NET LinkButton?
Try modifying your JavaScript method so that it returns "true" if you want the postback to occur...and "false" if you want it to stop.
Then change the LinkButton to so that it "returns" the value that is returned by the JavaScript method... This should stop the postback from occurring (but then again I've nevers een an EASI LinkButton before.......) -
<EASI:LinkButton ID="btnSearch" runat="server" CausesValidation="False" ClientScript="return confirmSearchOK();" UseSecurityLevel="True">Search</EASI:LinkButton>
JavaScript modification suggestion: -
function confirmSearchOK() {
-
var planSel = document.getElementById("<%= ddlPlanID.ClientID %>").selectedIndex;
-
var opSel = document.getElementById("<%= ddlOfferingPeriod.ClientID %>").selectedIndex;
-
var useEASi = document.getElementById("<%= hUseEASi.ClientID %>").value;
-
var epError = 0
-
-
if( useEASi == 'Y'){
-
if (document.getElementById("<%= ddlEnrollmentPeriod.ClientID %>").selectedIndex == 0)
-
epError = 1;
-
}
-
-
//alert("planSel: "+planSel+", opSel: "+opSel+", useEASi: "+useEASi+", epError: "+epError );
-
-
if( planSel == 0 )
-
{ alert("Error, must choose a Plan prior to Search");
-
return false;
-
}
-
else if( opSel == 0 )
-
{ alert("Error, must choose an Offering Period prior to Search");
-
return false;
-
}
-
else if( epError == 1 )
-
{ alert("Error, must choose an Enrollment Period prior to Search");
-
return false;
-
}
-
// else
-
// __doPostBack('btnSearch','');
-
return true;
-
}
-Frinny
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Assaf Weinberg |
last post by:
Using ASP.NET web form with VB.NET
I have a page with a calendar control that
onSelectionChanged builds a table control showing the
events scheduled for the selected calendar days. One of
the columns in this table contains linkbuttons that, when
clicked, should execute some code (currently an event
handler called showEvent) that displays...
|
by: Nikki |
last post by:
Hi,
I m developing a Windows application in which i want to create a
context menu, having variable number of submenus depending on the the
list in the file. I m able to create these submenus at runtime by
reading the file. But the problem is that there is no fixed count of
submenus and becaz of that i m not able to figure out "How to create...
|
by: George |
last post by:
I'm having a weird problem.
When I double-click a Web server control that I have on my design-time Web
form, such as a button, it puts the event handler in the Code Behind as a
Private Sub routine. However, when I try to compile, I get an error saying
that I can't access that event handler because it is Private.
When I change the event...
|
by: Divya |
last post by:
Hello
This is my 1st project where I have to create a Webcontrol. I have created a simple custom control with a button and 2 labels added to a panel. My problem is that the event handler that I have assigned to the button , is not getting invoked. Could anyone please go thru the code and let me know what I am missing here? Thanks in advance
...
|
by: Shreyash B. Patel |
last post by:
Hi,
I have a WebControl.Table on my WebForm. In the Table I have LinkButtons.
I inserted and created these link buttons dynamically. Please Look at the
Code below.
LinkButton lb = new LinkButton();
lb.Text = "Details";
lb.Click += new System.EventHandler(this.LinkButton_Click);
Table1.Rows.Cells.Controls.A(lb);
| |
by: Randy Fraser |
last post by:
What is the proper way of declaring an override on a button click event for
a base form.
I am getting " Cannot bind an event handler to the 'Click' event because it
is read only." listed in the events. It works but should I be getting this
message.
Base form:
Protected Overridable Sub btnSave_Click(ByVal sender As System.Object, ByVal
|
by: Kuldeep |
last post by:
Hello All,
Visual Studio 2005
ASP.NET 2.0
C#.NET 2.0
I have an application which has a Button click event procedure as given
below.
protected void btn_Click(object sender, EventArgs e)
|
by: weird0 |
last post by:
i have successfully emebedded visio drawing tool in my application.
Infinite number of shapes can be added to the drawing.
How can i write double click event handler for the the shapes added
to my diagram?
Other than that, how can i loop through all the shapes in the
diagram, to get their information?
Visio Guy
Amir Diwan
|
by: Navid |
last post by:
Hello,
I have a tree view which has Check Box's beside each node.
In the BeforeCheck event Handler I have canceled the event to
prevent the user from Checking/ Un-checking the box.
I am trying to now set up the DoubleClick event but the first time
the user double clicks the event is not called. For example the first
time clicked it will...
|
by: SAL |
last post by:
Hello,
I'm working, basically my first, AJAX page and am having a few problems.
One is that the Click event for a button I have in UpdatePanel1 is not
getting called. I've tried with the button both inside and outside of the
updatepanel and the event doesn't get called either way. What might I be
missing here?
Incidently, something else,...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |