WebControl.ToolTip -> window.status

G

Guest

Hello All,

For links in my page, I would like to change the window.status to show
something a little friendlier than
"javascript:WebForm_DoPostBackWithOptions(.............)".

I thought that using the ToolTip for the WebControl could be just the thing.
I have a function (see below signature) that recursively looks at the
controls on the page (and, if it HasControls, then at its child controls,
etc.), starting at "this". If the typeof() the control is one of a certain
set (such as ImageButton, LinkButton, etc.), it does something like:

webCtl.Attributes.Add("onmouseover", "window.status='" + webCtl.ToolTip +
"';");

That seems to work syntactically, except that I cannot figure out when to
call the function. The ToolTip property is always blank. Is this because I
am passing in Control and casting it to a WebControl when I find it's a
certain type? Or am I just not calling it at the correct time?

Thanks,
pagates

private void UpdateMyWindowStatus(Control ParentControl)
{
foreach (Control ctl in ParentControl.Controls)
{
if (ctl.HasControls())
UpdateMyWindowStatus(ctl);

Type CtlType = ctl.GetType();
if ((CtlType == typeof(LinkButton)) ||
(CtlType == typeof(ImageButton)) ||
(CtlType == typeof(LoginStatus)))
{
WebControl webCtl = (WebControl)ctl;
webCtl.Attributes.Add("onmouseover",
"window.status='" + webCtl.ToolTip + "'; return true;");
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top