Using this method you may find the control that raised the PostBack event on a page.
Code in C#:
public static Control GetPostBackControl(Page page)
{
Control control = null;
string ctrlname = page.Request.Params.Get("__EVENTTARGET");
if (ctrlname != null && ctrlname != string.Empty)
{
control = page.FindControl(ctrlname);
}
else
{
foreach (string ctl in page.Request.Form)
{
if ((ctl.LastIndexOf(".x") > 0) || (ctl.LastIndexOf(".y") > 0))
{
control = page.FindControl(ctl.Substring(0, ctl.Length - 2));
break;
}
/*control = page.FindControl(ctl);
if ((control is System.Web.UI.WebControls.Button))
{
break;
}*/
}
}
return control;
}
Thursday, September 24, 2009
Sunday, September 6, 2009
Using Named Anchor Tags To Move To a Different Section In Web Pages
The name Attribute
When the name attribute is used, the "a" element defines a named anchor inside a HTML document.
Named anchor are not displayed in any special way. They are invisible to the reader.
Named anchor syntax:

The link syntax to a named anchor:

The # in the href attribute defines a link to a named anchor.
Example:
A named anchor inside an HTML document:

A link to the Useful Tips Section from the same document:

A link to the Useful Tips Section from another document:
When the name attribute is used, the "a" element defines a named anchor inside a HTML document.
Named anchor are not displayed in any special way. They are invisible to the reader.
Named anchor syntax:

The link syntax to a named anchor:

The # in the href attribute defines a link to a named anchor.
Example:
A named anchor inside an HTML document:

A link to the Useful Tips Section from the same document:

A link to the Useful Tips Section from another document:

Subscribe to:
Posts (Atom)