Note that there are some explanatory texts on larger screens.

plurals
  1. POuser control event handler lost on postback
    primarykey
    data
    text
    <p>I have a menu usercontrol called LeftMenu that has a bulletedlist of linkitems. It's on the ascx page as such:</p> <pre><code>&lt;asp:BulletedList ID="PublisherList" DisplayMode="LinkButton" OnClick="PublisherList_Click" cssClass="Menu" runat="server"&gt;&lt;/asp:BulletedList&gt; </code></pre> <p>I databind the list in the page_load under <code>if(!isPostBack)</code></p> <p>I'm having an issue on a page that loads the control. When the page first loads, the event handler fires. However, when the page posts back it no longer fires and in IE8, when I'm debugging, I get "Microsoft JScript runtime error: Object expected" in Visual Studio pointing at "__doPostBack('LeftMenu$PublisherList','0')." In FF I don't get the error, but nothing happens. I'm <strong>not</strong> loading the control dynamically, it's loaded on the aspx page using:</p> <pre><code>&lt;%@ Register TagPrefix="Standards" TagName="LeftMenu" Src="LeftMenu.ascx" %&gt; &lt;Standards:LeftMenu ID="LeftMenu" runat="server"/&gt; </code></pre> <p>Any ideas of where I'm losing the event handler?</p> <p>I just realized this is happening on another user control I have as well. A text box and a button and I'm using the default button to make sure pressing the enter key uses that button. .Net converts that in the html to:</p> <pre><code> &lt;div id="SearchBarInclude_SearchBar" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'SearchBarInclude_QuickSearchButton')"&gt; </code></pre> <p>so as soon as i enter a key in the box I get a javascript error at the line saying "object expected." It seems like the two issues are related.</p> <p>Edit Again: I think I need to clarify. It's not that I'm clicking on the menu item and it can't find the selected item on postback. I have this search page with the left navigation on it and then the main content of the page is something that causes a postback. Everything is fine with this postback. Once that page has been posted back, now if I click on the bulleted list in the left navigation I get a javascript error and it fails. The page_init for the LeftMenu control is never called.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload