Click to See Complete Forum and Search --> : Tooltips for Checkboxlist individual elements???


SparkleWeb
04-04-2006, 10:38 AM
Hi!
I wanted to add a tooltip to an individual checkbox in a checkboxlist so that when someone did a mouseover on an individual checkbox, a little textbox pops up. Any genius has any idea regarding to this?
Please let me know.

Thanks

sirpelidor
04-04-2006, 12:44 PM
sounds like you want more then just a javascript bubble, check this out:

http://www.bosrup.com/web/overlib/?Download
(scroll ur mouse to the purple highlighted items)

I found a few websites have been using it.

SparkleWeb
04-04-2006, 02:23 PM
thanks for posting sirpelidor. But it is not related to my question at all.
Any others suggestion please. Mostly welcome. Thanks

sirpelidor
04-04-2006, 02:35 PM
it is not related to my question at all.


hi, maybe i mis-read your question or I read your question correctly, but I failed to represent my thoughts?

You want a "tool tip" thingie for your checkboxes. So when your mouse is over that checkbox, a box will display with message inside right?

the mouseover function is coded in javascript, not in .Net.
if you have a control named: chkbox, then the attribute will be something like:


<input type="checkbox" name="chkbox" onmouseover="showMessage(chkbox)">


under you javascript function (call showMessage(string controlName)), you just need to put the correct code to display the messages you wanted to display.

The link i showed you earlier, is a neat little way to display messages when mouse is over the controls (in the example they used, it was a label instead of checkbox, but the idea still the same)

move your mouse over to the highlighted text(try the text 'Download overLIB 4.21'), do you see a text message box? is it not the tooltip that you are talking about?

felgall
04-04-2006, 02:50 PM
<input type="checkbox" title="tooltip text" />

SparkleWeb
04-04-2006, 03:02 PM
[QUOTE=sirpelidor]You want a "tool tip" thingie for your checkboxes. So when your mouse is over that checkbox, a box will display with message inside right?


<input type="checkbox" name="chkbox" onmouseover="showMessage(chkbox)">

==========

Thankyou for your effort. My question is not for checkbox only it is CheckboxList. For example like below;

I need to give tool tips or text saying "ID" as "Identification number of your Card with 10 digits number and last four digits of Social Security..." and so on.

<CODE--------------->
<asp:CheckBoxList id="chkOptionsOne" runat="server" Width="136px" ToolTip="this">
<asp:ListItem Value="1">ID</asp:ListItem>
<asp:ListItem Value="2">DL</asp:ListItem>
<asp:ListItem Value="3">PM</asp:ListItem>
<asp:ListItem Value="4">AP</asp:ListItem>
</asp:CheckBoxList>
< code end---->

So not tool tips for "chkOptionOne" but it is tool tips for item displayed on that control list. i.e tool tips showing for ID,DL PM....when user put mouse on that word.

Hope that this clarify little bit more detaily.

Thanks for any ideas or suggestion

-----
SparkeWeb

Thanks,

sirpelidor
04-04-2006, 04:25 PM
Hi,
So your question really was: "how to insert attribute property inside a ASP web control"


<asp:CheckBoxList id="chkOptionsOne" runat="server" Width="136px" ToolTip="this">
<asp:ListItem Value="1">ID</asp:ListItem>
<asp:ListItem Value="2">DL</asp:ListItem>
<asp:ListItem Value="3">PM</asp:ListItem>
<asp:ListItem Value="4">AP</asp:ListItem>
</asp:CheckBoxList>
< code end---->

So not tool tips for "chkOptionOne" but it is tool tips for item displayed on that control list.


It doesn't matter if I'm refering the control itself to your javascript function, or the control(list) item, the concept still the same. After all, all these "controls" are just XML tag in a html document.

suppose under ur page_load is:

protected System.Web.UI.WebControls.CheckBoxList chkOptionsOne;
if (!this.ispostback){
string[] lstAry = {"ID","DL","PM","AP"}
chkOptionOne.datasource = lstAry;
this.databind;
loadAttribute();
}


ok...that was good enough to get you the controls, and now lets go to the method "loadAttribute()" and load your tooltip.


foreach (protected System.Web.UI.WebControls.CheckBox chkBox in chkOptionOne){
chkBox.Attributes.Add("onmouseover","ShowMessage(" + chkBox.ClientID + ")";
}


now, on ur javascript function (call: ShowMessage(control ID)) you just need to write code to take that control id, and display the approiate message, then it will display when mouse is over.

1) to show you how does it related back to my first post... that download allows you to put a nice neat little javascript message box after you give the control ID
2) doesn't matter with asp list control, when you click view source after the page is loaded, you will still see the same <input type="checkbox" name="chkbox" onmouseover="showMessage(ID)"> in html form, like i said, they are all XML in a html doc after all.
3) i wrote this off my head without the help of VS.net, so you need to read MSDN to make sure my methods and property calls are correct.