DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sun, 12 Aug 2007 13:22:02 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Ladislav Mrnka


ImageButton   
Hello,
I tryed to use ImageButton in application I am currently working on. My 
first idea was to use ImageButton just with AlternateText and add images 
after application logic is fully working.  Now I am wondering how odd the 
behavior of ImageButton is because it does not generate Click event when 
ImageUrl is not set up. I tryed it again outside of my application. I created 
new web site with just one page:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" 
Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ImageButton ID="btnAdd" AlternateText="Add" runat="server"
            OnClick="btnAdd_Click"  />
    </div>
    </form>
</body>
</html>

And code behind file:

using System;
using System.Web.UI;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    { }

    protected void btnAdd_Click(object sender, ImageClickEventArgs e)
    { }
}

Then I tryed to investigate behavior of ImageButton. If ImageUrl is set up 
it fires Page_Load and then btnAdd_Click as expected. But when ImageUrl is 
missing or even worse when it is set up but image does not exist or cannot be 
shown it fires only Page_Load and then second request arrives (GET HTTP 
method) which is not a post back. The behavior was same on VS 2005 integrated 
web server as well as on IIS 5. 

I assume ImageButton should rise click everytime otherwise it is useless. Am 
I right?

Thanks for any feedback,
Ladislav
Date:Sun, 12 Aug 2007 13:22:02 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us