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;");
}
}
}