Go to DotNetFunda.com
 Online : 692 |  Welcome, Guest!   Login
 
Home > Forums > ASP.NET > image postback url is fire instead of button click event ...

ASP.NET Forum



image postback url is fire instead of button click event

Author: APatel | Posted on: 11/7/2009 | Category: ASP.NET | Views: 1519 | Level: Starter | Status: [Member]

Hello All,

I have one page which have a one image button and one button control and two check box below is my code..

var flag_used;
window.onbeforeunload = function (oEvent) {
if (!oEvent) oEvent = window.event;//FF & IE support
if (flag_used)
return message;
}

function Test()
{
flag_used = true;
}

<asp:UpdatePanel ID="uxscr" runat="server">
<ContentTemplate>
<TTI:TTICheckbox ID="chkmale" runat="server" Text="Male" onclick="Test();" />
<TTI:TTICheckbox ID="chkfemale" runat="server" Text="FeMale" onclick="Test();" />
<asp:ImageButton ImageUrl="../1.gif" runat="Server" PostBackUrl="~/default.aspx" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="btn1" runat="server" OnClick="btn_OnClick" Text="click"/>
//Code behind page i have define one btn_Click event

Now, When i click on check box flag_used makes "true" then after i have click on image button confrim message open then i have click on cancle button and hit submit on button click(ID of control is btn1 which define outside update)

//Output:-
what happen instead of fire the click event of button they navigate to default.aspx page.

so can you please help me as soon as possible how can i fire button click event on page?

Thanks in advance,


Reply

Found interesting? Add this to:

| More

 Responses

SurajRane  
Posted on: 11/9/2009 1:52:59 AM
Level: Starter | Status: [Member] | Reply

I am sorry friend but can you just place whole code you have with you.

I am not getting exactly what you want to do. what i understood is,

you have to show user confirm message box on click of image button only when checkbox(s) is /are checked. and when user click cancel button on confirm box; you want to avoid redirection to default.aspx..

if is it so then following code will help you



function test() 

{
return confirm("Do you want to proceed??");
}


APatel, please login to Mark As Answer, if this helps | Alert Moderator 

Lakhangarg  
Posted on: 11/9/2009 6:14:31 AM
Level: Silver | Status: [Member] [Moderator] | Reply

Hi-

Please Post the code of this event btn_OnClick here.

Thanks & Regards
Lakhan Pal Garg

APatel, please login to Mark As Answer, if this helps | Alert Moderator 

APatel  
Posted on: 11/10/2009 12:13:01 AM
Level: Starter | Status: [Member] | Reply

Thanks for your reply,

"you have to show user confirm message box on click of image button only when checkbox(s) is /are checked. and when user click cancel button on confirm box; you want to avoid redirection to default.aspx.. "

yes, your understaning is correct but after click on cancel button on confirm message box then i want to click on submit button(full post back - outside update panel) and save value in database. but when i am click on submit button it will directly redirect to default.aspx page instead of saving value in Database.

So can you please help me how it is redirect to default.aspx page instead of fire click event?

Thank you,

APatel, please login to Mark As Answer, if this helps | Alert Moderator 

Virendradugar  
Posted on: 11/12/2009 3:25:37 AM
Level: Silver | Status: [Member] | Reply

Hi Apatel,

As requested previously by other users, kindly post your code of button click. That will help us to solve the problem.

Thanks,
Virendra Dugar

APatel, please login to Mark As Answer, if this helps | Alert Moderator 

Latest Posts

More ... 

 Write New Post


Advertisement

About Us | The Team | Advertise | Contact Us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you found plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 9/3/2010 3:59:44 AM