Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ImageButton

Thread Tools


Posts: n/a
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"

<html xmlns="" >
<head runat="server">
<title>Untitled Page</title>
<form id="form1" runat="server">
<asp:ImageButton ID="btnAdd" AlternateText="Add" runat="server"
OnClick="btnAdd_Click" />

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,
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid + ImageButton = Slooooowwwww Jake ASP .Net 2 08-04-2003 03:15 PM
Imagebutton over a little text Edmilson ASP .Net 1 07-30-2003 06:22 PM
How can I put some text on a imageButton Matthew ASP .Net 2 07-09-2003 12:23 PM
image/imagebutton client validation ganesh kolappan ASP .Net 2 07-03-2003 06:56 PM
Prevent Postback with ImageButton Marcelo ASP .Net 3 07-01-2003 07:13 PM