popup a window over button

  • Thread starter Thread starter niv
  • Start date Start date
N

niv

Hi,

I have an asp.net button control on a webform.
I would like to show a drop down window when the user
moves their mouse over the button.
The information in this dropdown or popup is going to be
coming from a dataset.

I have tried the following.
<INPUT onmouseover="func()" id="myButton"
type="button" value="Button1" style="Z-INDEX: 102; LEFT:
200px; POSITION: absolute; TOP: 104px"
runat="server">
<script type="text/javascript">
function func()
{
//you could put anything here, e.g. opening a window etc.
alert('Hi');
}

myButton.Attributes["onmouseover"]=String.Format("func
({0})", "my text");

I am not getting the result Im looking for with this code.
I took this code from this newsgroup.

Thanks for your help,

niv
 
Niv,

If you've looking for a hover tool tip when the user moves over a control
though, this is different (and probably better) and all you need to do is
create a button control ( <asp:Button> not <input> ) and then in your code
behind change the button's "tooltip" property. If this is what you want,
ignore the rest, else read on...

If you're getting the data that you want to populated your "pop-up" with
from a dataset, then you should add the control attribute in this in the
aspx page (design time), but rather as code behind (run-time)...


///////////////////////////////////////////////////////// aspx page
<!-- put this within the <Head> tags... -->

<script type="text/javascript">
function func( stringToDisplay )
{
//you could put anything here, e.g. opening a window etc.
alert(stringToDisplay);
}
</script>

</Head>
<Body>

<!-- other HTML/ASPX code here -->

<INPUT id="myButton"
type="button" value="Button1" style="Z-INDEX: 102; LEFT:
200px; POSITION: absolute; TOP: 104px"
runat="server">

<!-- etc... -->


///////////////////////////////////////////////////////// aspx.cs in the
Page_Load method.

string myString = "Testing";
myButton.Attributes["onmouseover"]= "func(" + myString + ");"


hope that helps...


Thanks.

Daniel.
 
Hi Daniel,
Thanks for the help.
I am going to try this now.
I owe you a beer.
-----Original Message-----
Niv,

If you've looking for a hover tool tip when the user moves over a control
though, this is different (and probably better) and all you need to do is
create a button control ( <asp:Button> not <input> ) and then in your code
behind change the button's "tooltip" property. If this is what you want,
ignore the rest, else read on...

If you're getting the data that you want to populated your "pop-up" with
from a dataset, then you should add the control attribute in this in the
aspx page (design time), but rather as code behind (run- time)...


///////////////////////////////////////////////////////// aspx page
<!-- put this within the <Head> tags... -->

<script type="text/javascript">
function func( stringToDisplay )
{
//you could put anything here, e.g. opening a window etc.
alert(stringToDisplay);
}
</script>

</Head>
<Body>

<!-- other HTML/ASPX code here -->

<INPUT id="myButton"
type="button" value="Button1" style="Z-INDEX: 102; LEFT:
200px; POSITION: absolute; TOP: 104px"
runat="server">

<!-- etc... -->


///////////////////////////////////////////////////////// aspx.cs in the
Page_Load method.

string myString = "Testing";
myButton.Attributes["onmouseover"]= "func(" + myString + ");"


hope that helps...


Thanks.

Daniel.

niv said:
Hi,

I have an asp.net button control on a webform.
I would like to show a drop down window when the user
moves their mouse over the button.
The information in this dropdown or popup is going to be
coming from a dataset.

I have tried the following.
<INPUT onmouseover="func()" id="myButton"
type="button" value="Button1" style="Z-INDEX: 102; LEFT:
200px; POSITION: absolute; TOP: 104px"
runat="server">
<script type="text/javascript">
function func()
{
//you could put anything here, e.g. opening a window etc.
alert('Hi');
}

myButton.Attributes["onmouseover"]=String.Format("func
({0})", "my text");

I am not getting the result Im looking for with this code.
I took this code from this newsgroup.

Thanks for your help,

niv


.
 
First remove onmouseover="func()" from <INPUT ...>.

In your previous message you just asked how to pass text to javascript
function. You didn't mention neither popup nor dropdown.

I don't think onmouseover event is good for that purpose.

Anyway, now you are asking how to get function func(..) to show a popup.
There are several ways of doing this. One is to use window.createPopup.
Another is to launch a modal window with window.showModalDialog. There is a
lot of differences between them and it is hard to advice without knowing
your specific requirements.

Eliyahu
 
Back
Top