Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

ImageButton

 
 
=?Utf-8?B?TGFkaXNsYXYgTXJua2E=?=
Guest
Posts: n/a
 
      08-12-2007
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
 
Reply With Quote
 
 
 
Reply

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



Advertisments