-
Apr 20th, 2012, 04:10 AM
#1
Thread Starter
Fanatic Member
asp button - problem calling server function
Hi All,
In my asp page I have:
Code:
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="checkFileExtension(MainContent_FileUpload1)" OnClick="Button1_Click" />
when I click the button my onClientClick gets called correctly this is a javascript function. My Button1_click event never gets called. on my aspx.cs page it is declared:
Code:
public void Button1_Click(object sender, EventArgs e)
I temporarily removed the onCLientClick event to see if that was interfering with this event, but it still never got called.
-
Apr 20th, 2012, 07:52 AM
#2
Re: asp button - problem calling server function
Make sure that function checkFileExtension is returning true or false depend upon ur validation? also it will be helpful if you can post the html mark up code
__________________
Rate the posts that helped you
-
Apr 20th, 2012, 07:31 PM
#3
Re: asp button - problem calling server function
I will laugh my ### off if this works.
Go to developer view, drag a button and then double click on it so it automatically creates the event for click.
Then try your code.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Apr 20th, 2012, 08:36 PM
#4
Frenzied Member
Re: asp button - problem calling server function
hello,
as riteshjain1982 check your javascript function, if it return false then your server side event will not be called
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011
-
Apr 23rd, 2012, 08:29 AM
#5
Thread Starter
Fanatic Member
Re: asp button - problem calling server function
in my Javascript function I already had return true and return false down their respective paths.
I tried Sapator's suggestion and it did indeed cause my server side event to trigger, however, this triggers regardless of the value returned by my clientside function i.e. return true or false serverside still triggers.
-
Apr 23rd, 2012, 08:07 PM
#6
Re: asp button - problem calling server function
Originally Posted by Bill Crawley
I tried Sapator's suggestion and it did indeed cause my server side event to trigger
Gotta love Microsoft!
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Apr 24th, 2012, 03:06 AM
#7
Thread Starter
Fanatic Member
Re: asp button - problem calling server function
when the client function returns false, I do not want the server fuhnction to trigger, but now it does regardless
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
|