CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 3/31/2004 2:01:57 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 45 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
sadji
Asp.Net User
capture mouse click on HtmlInputImage on the server control3/31/2004 2:01:57 PM

0/0

Hello,
i am doing a server control which use un HtmlInputImage, I am having problem on capturing mouse click event on the image.

1. is it possible to bubble event to my parent page( myPage.aspx) in order to catch the coords of my mouse click and invoke methode "onImgClick (e.X, e.Y) ? (the problem was the eventArgs dont have e.X and e.Y and couldnt get ImageClickEventArgs ... )

2. if bubbling is not possible, then i would like to call the methode "onImgClick" by delegeting it to the HtmlInputImage, how can i do this?

thanx,
s.


this is my control code: ( which is used by myPage.aspx)

// ctrl1.cs (simplified)
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

namespace SrvCtrl
{
[DefaultProperty("Text"),
ToolboxData("<{0}:ctrl1 runat=server></{0}:ctrl1>")]
public class ctrl1 : System.Web.UI.WebControls.WebControl
{
private string text;

[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string Text
{ get { return text; }
set { text = value;}
}

protected override void Render(HtmlTextWriter output)
{
output.AddAttribute(HtmlTextWriterAttribute.Type, "image");
output.AddAttribute(HtmlTextWriterAttribute.Src, "http://mysite.com/pic.gif");
output.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
output.RenderBeginTag(HtmlTextWriterTag.Input);
output.RenderEndTag();
output.Write(Text);
}

protected void onImgClick(int x, int y)
{
Text= "you clicked here "+ x.ToString() + ", " + y.ToString() ;
}

}
}
joteke
Asp.Net User
Re: capture mouse click on HtmlInputImage on the server control3/31/2004 7:26:46 PM

0/0

Are you rewriting exactly what ImageButton already does (it can provide coords in its Click event)? Basically, you need to raise an event (probably Click event) from the Control in which you provide enough arguments (X and Y coords) so that subscriber gets what is needed. You would also need to parse those X and Y coordinates from postback data and to get into this data, you'd need to implement IPostBackDataHandler interface (where you might lead to raising a postback event).

This goes to the exact same implementation than ImageButton already has, so do you have the chance to straight inherit from ImageButton or are you doing this in studying sense?

Have you checked Justin Lovell's server control articles at AspAlliance? Here's a link to his profile where all articles are listed.

http://www.aspalliance.com/author.aspx?uId=38556
Thanks,

Teemu Keiski
Finland, EU
master4eva
Asp.Net User
Re: capture mouse click on HtmlInputImage on the server control4/1/2004 4:30:06 AM

0/0

Technically speaking, the ImageButton does all the work that you need. All you need to do is re-use the control, if nescary. You can have a look at an article that I have already written over here:

http://aspalliance.com/350
-- Justin Lovell
sadji
Asp.Net User
Re: capture mouse click on HtmlInputImage on the server control4/1/2004 7:47:09 AM

0/0

No i am not rewriting ImageButton, i've fail to use it correctly( it dosen't refresh) so that i use HtmlInputImage and was having problem on handling ImageClickEventArgs.
(raising Click event only gives me EventArgs not ImageClickEventArgs)

finally, i end up with using ImageButton correctly and fire up the correct event, with the help of Justin Lovell article which do smilier to my prog. http://aspalliance.com/articleViewer.aspx?aId=359&pId=4

thanx :)
Regards,
s.

master4eva
Asp.Net User
Re: capture mouse click on HtmlInputImage on the server control4/1/2004 10:43:23 AM

0/0

Glad that you found your answer in one of my articles :-) .
-- Justin Lovell
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
External interface memory leak? - macromedia.flash.actionscript3 ... want to pass data from an aspx wep page to the windows ce device on which the page is open · capture mouse click on htmlinputimage on the server control ...
Server Controls Then, right-click the element, and choose Run As Server Control to add the ..... HtmlAnchor, HtmlForm, HtmlButton, HtmlInputButton, HtmlInputImage ...
TheMSsForum.com >> Csharp >> "How to create click event handler ... HtmlInputImage.Border I am building my html page in .net. After i click a button , ... The property sheet autohides when the mouse leaves the area. ...
Slide 1 Visible property - Boolean value that indicates whether a Server control is rendered as .... To capture mouse clicks, use ImageButton. Introduction to ASP. ...
Server Controls The ServerClick event is simply a click that is processed on the server side. .... Displays a text message when the user hovers the mouse above the control. ...
Programming Microsoft ASP.NET 英文翻译- IT民工(小赖) - 博客园 The HtmlInputImage control supports a nearly identical pattern for handling ..... to capture mouse clicks on the image, use the ImageButton control instead. ...
Overview When using a server control that acts as a container, any events that ...... If you need to capture mouse clicks on the image, use the ImageButton control ...
DotNet listbox selectedindexchanged mouse click mouse double click mousedown events ...... HtmlInputButton HtmlInputCheckButton HtmlInputImage A sample Code for ...
.NET C# Page 85 - Bytes Site Map MS Power Point mouse events to C# Addin · interacting with xml · How to implement .... How to attach a control to combobox drop down event? ...
DotNetMost Ask In any windows application when you right-click your mouse you get a menu which might ..... This causes the HTML element to be treated as a server control. ...




Search This Site:










can i do this in .net

gc.suppressfinalize(me)

downloading excel ...

how can i inhirit an xml document?

asp:label to uppercase

how to hide asp:button if gridview returns no rows?

any recommended communication tools for web applicaitons

how to process a form stored in a db as an aspx page?

calendar application

using redirectfromloginpage

catch all validation message

xhtml...

server.mappath()

changing the language

asp programming not running, dll problem

best collection for comparing data...

is refresh a postback?

difference between passing by reference and value

request help

determine debug/release mode

get first letter in a textbox

connection pooling

help!! i dont want frames in my site!

wmi connection error to remote machine

wondering how i should approach this one...reducing code bloat

dropdown list

wrap text

override a class

including a .html file inside the aspx file

a simple question about code structure and code placement.

  Privacy | Contact Us
All Times Are GMT