This is a migrated thread and some comments may be shown as answers.

Cancel RadListBox client click event

3 Answers 119 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
guillaume.lebel
Top achievements
Rank 1
Iron
Iron
guillaume.lebel asked on 18 Oct 2010, 03:13 PM
Hi,

I have a listbox with different items that display different elements in my page when i click on it. But if the user has modified anything in the page i'm calling a confirm window to be sure the user want to change his current selected item without saving the change.

The thing is i'm using OnClientSelectedIndexChanged and it still doing a post back even if i have call args.set_cancel(true).

Is there a way to cancel the client click without doing a post back in my page???

Thx for your help,

Guillaume

3 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 18 Oct 2010, 08:58 PM
Move your code to OnClientSelectedIndexChanging, since you can only cancel the event there.

I hope that helps.
0
guillaume.lebel
Top achievements
Rank 1
Iron
Iron
answered on 19 Oct 2010, 01:16 PM
Hi thx for your quick answer,

I just made i mistake in my previous message, i'm already using the OnClientSelectedIndexChanging. Sorry about that.

What i was saying, is that the event seems to not being cancel (args.set_cancel(true)) and it still doing the postback if i cancel  the selectedindexchanging event.

Again thx for your help,

Guillaume
0
Genady Sergeev
Telerik team
answered on 22 Oct 2010, 04:24 PM
Hello guillaume.lebel,

Please consider removing the AutoPostBack = true declaration from RadListBox should posting back to the server is not desired. The set_cancel property in the SelectedIndexChanging event args serves for canceling the selection of the given item, not for preventing a postback. However, it indeed makes sense that canceling the selectionIndexChanging should not postback the page. We will research what side effects might such change have to RadListBox.

Sincerely yours,
Genady Sergeev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ListBox
Asked by
guillaume.lebel
Top achievements
Rank 1
Iron
Iron
Answers by
Cori
Top achievements
Rank 2
guillaume.lebel
Top achievements
Rank 1
Iron
Iron
Genady Sergeev
Telerik team
Share this question
or