user1522075
user1522075

Reputation: 1

ASP.Net suppress postback for combobox only for OnSelectedIndexChanged

I am using an AJAX ComboBox in my ASP.Net web application and I have an OnItemInserted event that requires a postback to hit the server side logic however this requires that I have AutoPostBack = True. This causes an unwanted effect of OnSelectedIndexChanged event triggering a Postback causing the control to lose focus.

More background: This combobox resides inside of a fairly complex gridview which contains other comboboxes, dropdownlists, and textboxes. My objective is to allow the user to smoothly tab through the row while entering data without having to use the mouse to promote rapid data entry.

I believe that I need to utilize javascript to suppress this postback but I am open to suggestions.

Upvotes: 0

Views: 899

Answers (2)

KennyZ
KennyZ

Reputation: 907

OnSelectedIndexChanged="return false"

Upvotes: 0

Chris Snyder
Chris Snyder

Reputation: 968

You can suppress the postback by simply returning false on the relevant client event:

http://edgewaters.blogspot.com/2008/01/button-that-doesnt-post-back.html

Upvotes: 2

Related Questions