Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Saturday, March 31, 2012

Strange Behavior

When I drag and drop my custom control on to the webform, it displays as a little (resizable) square in design.
If I click the html tab to go to html view, then click the Design tab again, the control shows just fine (like a regular textbox).

Is there some event I am missing or a property that needs to be set?

The top is what is looks like when I place the control on the form.
The bottom is what it looks like when I go to html view and then back to design view...

http://vbforums.com/attachment.php?s=&postid=1669737

Any Ideas what is going on?Solution: I had to override the render event.
Like this

Protected Overrides Sub render(output As HtmlTextWriter)
EnsureChildControls()
MyBase.Render()
End Sub

Thursday, March 22, 2012

Strange HTML button postback

I have a webform with lots of <asp:...controls but I need couple of buttons
that doesn't cause an automatic postback. I use javascript to handle these
buttons. I tried two approaches with different results:

<IMG onmouseup="src='Bitmaps/Controls/measure_over.bmp';"
onmousedown="src='Bitmaps/Controls/measure_pressed.bmp';"
id="measure" onmouseover="src='Bitmaps/Controls/measure_over.bmp';"
style="LEFT: 170px; WIDTH: 24px; POSITION: absolute; TOP: 2px; HEIGHT: 25px"
onclick="buttonClicked(this.id);"
onmouseout="src='Bitmaps/Controls/measure_btn.bmp';"
alt="" src="http://pics.10026.com/?src=Bitmaps/Controls/measure_btn.bmp"
This is working the way I want to, but I can't disable it as I can with a
button. I then replace the IMG with:

INPUT Type="image"

and it makes a postback every time I click on it. Why? A HTML control
should't do that, right? The script itself (buttonClicked) just fills a
hidden field.

/MiroFrom the MSDN Library about the <input typ="image" tag:

------------------------
INPUT type=image Element | input type=image Object
Creates an image control that, when clicked, causes the form to be
immediately submitted.
------------------------

Maybe add "onclick='return false;'" to the tag.

-Jason Kendall
JasonKendall@.hotmail.com

On Tue, 1 Feb 2005 05:55:13 -0800, "Miro"
<Miro@.discussions.microsoft.com> wrote:

>I have a webform with lots of <asp:...controls but I need couple of buttons
>that doesn't cause an automatic postback. I use javascript to handle these
>buttons. I tried two approaches with different results:
><IMG onmouseup="src='Bitmaps/Controls/measure_over.bmp';"
>onmousedown="src='Bitmaps/Controls/measure_pressed.bmp';"
>id="measure" onmouseover="src='Bitmaps/Controls/measure_over.bmp';"
>style="LEFT: 170px; WIDTH: 24px; POSITION: absolute; TOP: 2px; HEIGHT: 25px"
>onclick="buttonClicked(this.id);"
>onmouseout="src='Bitmaps/Controls/measure_btn.bmp';"
>alt="" src="http://pics.10026.com/?src=Bitmaps/Controls/measure_btn.bmp">
>This is working the way I want to, but I can't disable it as I can with a
>button. I then replace the IMG with:
>INPUT Type="image"
>and it makes a postback every time I click on it. Why? A HTML control
>should't do that, right? The script itself (buttonClicked) just fills a
>hidden field.
>/Miro

Strange HTML button postback

I have a webform with lots of <asp:...controls but I need couple of buttons
that doesn't cause an automatic postback. I use javascript to handle these
buttons. I tried two approaches with different results:
<IMG onmouseup="src='Bitmaps/Controls/measure_over.bmp';"
onmousedown="src='Bitmaps/Controls/measure_pressed.bmp';"
id="measure" onmouseover="src='Bitmaps/Controls/measure_over.bmp';"
style="LEFT: 170px; WIDTH: 24px; POSITION: absolute; TOP: 2px; HEIGHT: 25px"
onclick="buttonClicked(this.id);"
onmouseout="src='Bitmaps/Controls/measure_btn.bmp';"
alt="" src="http://pics.10026.com/?src=Bitmaps/Controls/measure_btn.bmp">
This is working the way I want to, but I can't disable it as I can with a
button. I then replace the IMG with:
INPUT Type="image"
and it makes a postback every time I click on it. Why? A HTML control
should't do that, right? The script itself (buttonClicked) just fills a
hidden field.
/MiroFrom the MSDN Library about the <input typ="image" tag:
----
--
INPUT type=image Element | input type=image Object
Creates an image control that, when clicked, causes the form to be
immediately submitted.
----
--
Maybe add "onclick='return false;'" to the tag.
-Jason Kendall
JasonKendall@.hotmail.com
On Tue, 1 Feb 2005 05:55:13 -0800, "Miro"
<Miro@.discussions.microsoft.com> wrote:

>I have a webform with lots of <asp:...controls but I need couple of buttons
>that doesn't cause an automatic postback. I use javascript to handle these
>buttons. I tried two approaches with different results:
><IMG onmouseup="src='Bitmaps/Controls/measure_over.bmp';"
>onmousedown="src='Bitmaps/Controls/measure_pressed.bmp';"
>id="measure" onmouseover="src='Bitmaps/Controls/measure_over.bmp';"
>style="LEFT: 170px; WIDTH: 24px; POSITION: absolute; TOP: 2px; HEIGHT: 25px
"
>onclick="buttonClicked(this.id);"
>onmouseout="src='Bitmaps/Controls/measure_btn.bmp';"
>alt="" src="http://pics.10026.com/?src=Bitmaps/Controls/measure_btn.bmp">
>This is working the way I want to, but I can't disable it as I can with a
>button. I then replace the IMG with:
>INPUT Type="image"
>and it makes a postback every time I click on it. Why? A HTML control
>should't do that, right? The script itself (buttonClicked) just fills a
>hidden field.
>/Miro