TiltingCode
Programmer
I've tried two ways to check for null and neither work:
I have a menu control and when I click a link the below event is fired. I tried two ways to check for null and neither work. Can someone please help?
protected void MenuItems_OnMenuItemClick(object sender, MenuEventArgs e)
{
try
{
if ( e.Item.Text != null)
{
Debug.WriteLine("MenuItem: " + e.Item.Text );
}
}
catch(Exception ex)
{
throw (ex);
}
}
And:
protected void MenuItems_OnMenuItemClick(object sender, MenuEventArgs e)
{
try
{
System.Web.UI.WebControls.MenuItem mi = new System.Web.UI.WebControls.MenuItem();
if (mi.Parent.Text != null)
{
Debug.WriteLine("MenuItem: " + e.Item.Text );
}
}
catch(Exception ex)
{
throw (ex);
}
}