hi
I used below codes in website page this is for selected Item from menu:
<script src='<%=ResolveUrl("~/scripts/jquery1.8.3.js" ) %>'></script>
<script type="text/javascript">
$(function () {
var selctedMenuHtml = $('[id*=hdnFieldID]').val();
//alert(selctedMenuHtml);
var selectedMenu = $.grep($('[id*=MM21] ul a'), function (ele) {
return $(ele).html().trim() == selctedMenuHtml.trim();
}).pop();
$(selectedMenu).addClass('SelectedActiveMenu');
$(selectedMenu).focus();
});
</script>
and
protected void Page_Load(object sender, EventArgs e)
{
hdnFieldID.Value = Session["selctedMenuHtml"].ToString();
here when I stay much time on the website and then refresh the page or select an Item from the menu below errors occur:
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error:
Line 18: {
Line 19:
Line 20: hdnFieldID.Value = Session["selctedMenuHtml"].ToString();
Line 21:
Line 22:
|
why this happen and how I can solve it?
Best regards
Neda