If your Visual Studio is not configured to stop on the occurrence of the exception, here is the way to turn it on:
Monday, January 2, 2017
How to break when exception is thrown in C#
Sometimes during debugging an application, an unhandled exception is encountered in which we need to investigate. To find the details of this exception, we need to stop at the point of occurrence and check out the whole exception object or line of code that has a fault.
If your Visual Studio is not configured to stop on the occurrence of the exception, here is the way to turn it on:
If your Visual Studio is not configured to stop on the occurrence of the exception, here is the way to turn it on:
Find Control in .NET using Control ID
Here is a snippet that I have used to find a control in ASP.NET recursively:
private static Control FindControlRecursive(Control Root, string Id)
{
if (Root.ID == Id)
{
return Root;
}
foreach (Control Ctl in Root.Controls)
{
Control FoundCtl = FindControlRecursive(Ctl, Id);
if (FoundCtl != null)
{
return FoundCtl;
}
}
return null;
}
private static Control FindControlRecursive(Control Root, string Id)
{
if (Root.ID == Id)
{
return Root;
}
foreach (Control Ctl in Root.Controls)
{
Control FoundCtl = FindControlRecursive(Ctl, Id);
if (FoundCtl != null)
{
return FoundCtl;
}
}
return null;
}
Subscribe to:
Posts (Atom)

