|
|
|
start date: Tue, 21 Aug 2007 10:35:00 -0700,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Lit
|
|
2
Steve
|
|
3
Lit
|
|
4
Steve
|
|
5
Lit
|
|
6
Steve
|
|
7
Lit
|
|
8
Lit
|
Listbox vertical scroll position capture
Hi,
How can I capture the vertical scroll bar position for a Listbox.
I have a Listbox of 100 items + when I click on it I post back remove the
item selected.
After returning to the client browser the list box scroll position is at the
top.
I want it to be remain in the Proximity of where it was before.
Can I capture the vertical scroll bar position of a ListBox in JavaScript
and set it?
Thank you,
Lit
Date:Tue, 21 Aug 2007 10:35:00 -0700
Author:
|
Re: Listbox vertical scroll position capture
I reproduced what you're getting, and fixed it using this code:
Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim x As Integer = ListBox1.SelectedIndex
ListBox1.Items.Remove(ListBox1.SelectedItem)
ListBox1.SelectedIndex = x + 1
End Sub
Steve C.
MCAD,MCSE,MCP+I,CNE,CNA,CCNA
Lit wrote:
> Hi,
>
> How can I capture the vertical scroll bar position for a Listbox.
>
> I have a Listbox of 100 items + when I click on it I post back remove the
> item selected.
>
> After returning to the client browser the list box scroll position is at the
> top.
>
> I want it to be remain in the Proximity of where it was before.
>
> Can I capture the vertical scroll bar position of a ListBox in JavaScript
> and set it?
>
> Thank you,
>
> Lit
>
>
Date:Tue, 21 Aug 2007 13:54:54 -0400
Author:
|
Re: Listbox vertical scroll position capture
Steve,
Here is the problem:
After post back I don't want the selected Index set because I can no longer
select that Item by just clicking on it to cause a post back
I have an onSelectedIndexChanged event that fires when a list item is
selected.
How do I scroll as if I am a user scrolling without selecting anything.
( x below can be index out of bounds if last or listbox is empty )
Any JavaScript tricks, any other Ideas you can think off.
Thank you,
Lit
"Steve" wrote in message
news:esaHixB5HHA.1208@TK2MSFTNGP03.phx.gbl...
>I reproduced what you're getting, and fixed it using this code:
>
>
> Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal
> e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
> Dim x As Integer = ListBox1.SelectedIndex
> ListBox1.Items.Remove(ListBox1.SelectedItem)
> ListBox1.SelectedIndex = x + 1
> End Sub
>
>
> Steve C.
> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
>
>
> Lit wrote:
>> Hi,
>>
>> How can I capture the vertical scroll bar position for a Listbox.
>>
>> I have a Listbox of 100 items + when I click on it I post back remove the
>> item selected.
>>
>> After returning to the client browser the list box scroll position is at
>> the top.
>>
>> I want it to be remain in the Proximity of where it was before.
>>
>> Can I capture the vertical scroll bar position of a ListBox in JavaScript
>> and set it?
>>
>> Thank you,
>>
>> Lit
>>
Date:Tue, 21 Aug 2007 11:04:36 -0700
Author:
|
Re: Listbox vertical scroll position capture
I understand. You're removing the item at index "x", so you can't select
it anymore. If you set the SelectedIndex to x+1 (or even x-1), that will
cause the item after (or before) to be the currently selected item. The
auto-postback still works, the item is still deleted, and the listbox
scroll position is still preserved.
You can try to capture that via Javascript, but in this case, it's not
needed, and just adds to the complexity. Besides, if you're using a
postback, you're already making the round-trip to the server, so you
might as well do everything there, right?
Steve C.
MCAD,MCSE,MCP+I,CNE,CNA,CCNA
Lit wrote:
> Steve,
>
> Here is the problem:
>
> After post back I don't want the selected Index set because I can no longer
> select that Item by just clicking on it to cause a post back
> I have an onSelectedIndexChanged event that fires when a list item is
> selected.
>
> How do I scroll as if I am a user scrolling without selecting anything.
>
> ( x below can be index out of bounds if last or listbox is empty )
>
> Any JavaScript tricks, any other Ideas you can think off.
>
> Thank you,
>
>
> Lit
>
>
>
> "Steve" wrote in message
> news:esaHixB5HHA.1208@TK2MSFTNGP03.phx.gbl...
>> I reproduced what you're getting, and fixed it using this code:
>>
>>
>> Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal
>> e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
>> Dim x As Integer = ListBox1.SelectedIndex
>> ListBox1.Items.Remove(ListBox1.SelectedItem)
>> ListBox1.SelectedIndex = x + 1
>> End Sub
>>
>>
>> Steve C.
>> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
>>
>>
>> Lit wrote:
>>> Hi,
>>>
>>> How can I capture the vertical scroll bar position for a Listbox.
>>>
>>> I have a Listbox of 100 items + when I click on it I post back remove the
>>> item selected.
>>>
>>> After returning to the client browser the list box scroll position is at
>>> the top.
>>>
>>> I want it to be remain in the Proximity of where it was before.
>>>
>>> Can I capture the vertical scroll bar position of a ListBox in JavaScript
>>> and set it?
>>>
>>> Thank you,
>>>
>>> Lit
>>>
>
Date:Tue, 21 Aug 2007 14:22:41 -0400
Author:
|
Re: Listbox vertical scroll position capture
Hi Steve,
I am using AJAX so my post back is not the ALL-Page Postback.
I select from the "Source" list box, add the item to a "Destination" list
box and remove the item that was selected from the "Source" listbox.
Now if I ( x+1, or x-1 ) I can NO longer select that selected item to
trigger a postback, remember I am not clicking on a button.
The selected index change event does not fire when something is already been
selected.
Also if I change to x+1 or x-1 the event is fired on the server side, I
think so I have to disable the event before x+1 or x-1 then enable it
again.
How can I capture the list box vertical scroll position in JavaScript and
set it without selecting anything in the listbox
Is this doable for a listbox?
Does <Select Selected > Fire An event, if not that is good. if yes that
is not the behavior I want.
Thanks for taking the time to thing this with me.
Lit
"Steve" wrote in message
news:uec5DBC5HHA.1184@TK2MSFTNGP04.phx.gbl...
>I understand. You're removing the item at index "x", so you can't select it
>anymore. If you set the SelectedIndex to x+1 (or even x-1), that will cause
>the item after (or before) to be the currently selected item. The
>auto-postback still works, the item is still deleted, and the listbox
>scroll position is still preserved.
>
> You can try to capture that via Javascript, but in this case, it's not
> needed, and just adds to the complexity. Besides, if you're using a
> postback, you're already making the round-trip to the server, so you might
> as well do everything there, right?
>
>
>
> Steve C.
> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
>
>
> Lit wrote:
>> Steve,
>>
>> Here is the problem:
>>
>> After post back I don't want the selected Index set because I can no
>> longer select that Item by just clicking on it to cause a post back
>> I have an onSelectedIndexChanged event that fires when a list item is
>> selected.
>>
>> How do I scroll as if I am a user scrolling without selecting anything.
>>
>> ( x below can be index out of bounds if last or listbox is empty )
>>
>> Any JavaScript tricks, any other Ideas you can think off.
>>
>> Thank you,
>>
>>
>> Lit
>>
>>
>>
>> "Steve" wrote in message
>> news:esaHixB5HHA.1208@TK2MSFTNGP03.phx.gbl...
>>> I reproduced what you're getting, and fixed it using this code:
>>>
>>>
>>> Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object,
>>> ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
>>> Dim x As Integer = ListBox1.SelectedIndex
>>> ListBox1.Items.Remove(ListBox1.SelectedItem)
>>> ListBox1.SelectedIndex = x + 1
>>> End Sub
>>>
>>>
>>> Steve C.
>>> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
>>>
>>>
>>> Lit wrote:
>>>> Hi,
>>>>
>>>> How can I capture the vertical scroll bar position for a Listbox.
>>>>
>>>> I have a Listbox of 100 items + when I click on it I post back remove
>>>> the item selected.
>>>>
>>>> After returning to the client browser the list box scroll position is
>>>> at the top.
>>>>
>>>> I want it to be remain in the Proximity of where it was before.
>>>>
>>>> Can I capture the vertical scroll bar position of a ListBox in
>>>> JavaScript and set it?
>>>>
>>>> Thank you,
>>>>
>>>> Lit
>>>>
>>
Date:Tue, 21 Aug 2007 11:35:43 -0700
Author:
|
Re: Listbox vertical scroll position capture
Ahhh, AJAX. Okay, so you've got to preserve the scroll location without
re-selecting any item in the listbox. I don't think I've ever seen any
Javascript that can do that, but I'm not a Javascript guru.
Try reposting this in the MS JScript newsgroups. I know JScript isn't
*exactly* javascript, but I don't think MS has an ASP.NET Ajax newsgroup
yet.
Lit wrote:
> Hi Steve,
>
> I am using AJAX so my post back is not the ALL-Page Postback.
> I select from the "Source" list box, add the item to a "Destination" list
> box and remove the item that was selected from the "Source" listbox.
> Now if I ( x+1, or x-1 ) I can NO longer select that selected item to
> trigger a postback, remember I am not clicking on a button.
> The selected index change event does not fire when something is already been
> selected.
>
> Also if I change to x+1 or x-1 the event is fired on the server side, I
> think so I have to disable the event before x+1 or x-1 then enable it
> again.
>
> How can I capture the list box vertical scroll position in JavaScript and
> set it without selecting anything in the listbox
> Is this doable for a listbox?
>
> Does <Select Selected > Fire An event, if not that is good. if yes that
> is not the behavior I want.
>
> Thanks for taking the time to thing this with me.
>
> Lit
>
>
>
> "Steve" wrote in message
> news:uec5DBC5HHA.1184@TK2MSFTNGP04.phx.gbl...
>> I understand. You're removing the item at index "x", so you can't select it
>> anymore. If you set the SelectedIndex to x+1 (or even x-1), that will cause
>> the item after (or before) to be the currently selected item. The
>> auto-postback still works, the item is still deleted, and the listbox
>> scroll position is still preserved.
>>
>> You can try to capture that via Javascript, but in this case, it's not
>> needed, and just adds to the complexity. Besides, if you're using a
>> postback, you're already making the round-trip to the server, so you might
>> as well do everything there, right?
>>
>>
>>
>> Steve C.
>> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
>>
>>
>> Lit wrote:
>>> Steve,
>>>
>>> Here is the problem:
>>>
>>> After post back I don't want the selected Index set because I can no
>>> longer select that Item by just clicking on it to cause a post back
>>> I have an onSelectedIndexChanged event that fires when a list item is
>>> selected.
>>>
>>> How do I scroll as if I am a user scrolling without selecting anything.
>>>
>>> ( x below can be index out of bounds if last or listbox is empty )
>>>
>>> Any JavaScript tricks, any other Ideas you can think off.
>>>
>>> Thank you,
>>>
>>>
>>> Lit
>>>
>>>
>>>
>>> "Steve" wrote in message
>>> news:esaHixB5HHA.1208@TK2MSFTNGP03.phx.gbl...
>>>> I reproduced what you're getting, and fixed it using this code:
>>>>
>>>>
>>>> Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object,
>>>> ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
>>>> Dim x As Integer = ListBox1.SelectedIndex
>>>> ListBox1.Items.Remove(ListBox1.SelectedItem)
>>>> ListBox1.SelectedIndex = x + 1
>>>> End Sub
>>>>
>>>>
>>>> Steve C.
>>>> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
>>>>
>>>>
>>>> Lit wrote:
>>>>> Hi,
>>>>>
>>>>> How can I capture the vertical scroll bar position for a Listbox.
>>>>>
>>>>> I have a Listbox of 100 items + when I click on it I post back remove
>>>>> the item selected.
>>>>>
>>>>> After returning to the client browser the list box scroll position is
>>>>> at the top.
>>>>>
>>>>> I want it to be remain in the Proximity of where it was before.
>>>>>
>>>>> Can I capture the vertical scroll bar position of a ListBox in
>>>>> JavaScript and set it?
>>>>>
>>>>> Thank you,
>>>>>
>>>>> Lit
>>>>>
>
>
Date:Tue, 21 Aug 2007 14:51:31 -0400
Author:
|
Re: Listbox vertical scroll position capture
Steve,
thank you for your input, I will have to research this or come up with
other UI
Lit
"Steve" wrote in message
news:eZZ3LRC5HHA.5360@TK2MSFTNGP03.phx.gbl...
> Ahhh, AJAX. Okay, so you've got to preserve the scroll location without
> re-selecting any item in the listbox. I don't think I've ever seen any
> Javascript that can do that, but I'm not a Javascript guru.
>
> Try reposting this in the MS JScript newsgroups. I know JScript isn't
> *exactly* javascript, but I don't think MS has an ASP.NET Ajax newsgroup
> yet.
>
>
>
>
> Lit wrote:
>> Hi Steve,
>>
>> I am using AJAX so my post back is not the ALL-Page Postback.
>> I select from the "Source" list box, add the item to a "Destination"
>> list box and remove the item that was selected from the "Source" listbox.
>> Now if I ( x+1, or x-1 ) I can NO longer select that selected item to
>> trigger a postback, remember I am not clicking on a button.
>> The selected index change event does not fire when something is already
>> been selected.
>>
>> Also if I change to x+1 or x-1 the event is fired on the server side, I
>> think so I have to disable the event before x+1 or x-1 then enable it
>> again.
>>
>> How can I capture the list box vertical scroll position in JavaScript and
>> set it without selecting anything in the listbox
>> Is this doable for a listbox?
>>
>> Does <Select Selected > Fire An event, if not that is good. if yes
>> that is not the behavior I want.
>>
>> Thanks for taking the time to thing this with me.
>>
>> Lit
>>
>>
>>
>> "Steve" wrote in message
>> news:uec5DBC5HHA.1184@TK2MSFTNGP04.phx.gbl...
>>> I understand. You're removing the item at index "x", so you can't select
>>> it anymore. If you set the SelectedIndex to x+1 (or even x-1), that will
>>> cause the item after (or before) to be the currently selected item. The
>>> auto-postback still works, the item is still deleted, and the listbox
>>> scroll position is still preserved.
>>>
>>> You can try to capture that via Javascript, but in this case, it's not
>>> needed, and just adds to the complexity. Besides, if you're using a
>>> postback, you're already making the round-trip to the server, so you
>>> might as well do everything there, right?
>>>
>>>
>>>
>>> Steve C.
>>> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
>>>
>>>
>>> Lit wrote:
>>>> Steve,
>>>>
>>>> Here is the problem:
>>>>
>>>> After post back I don't want the selected Index set because I can no
>>>> longer select that Item by just clicking on it to cause a post back
>>>> I have an onSelectedIndexChanged event that fires when a list item is
>>>> selected.
>>>>
>>>> How do I scroll as if I am a user scrolling without selecting anything.
>>>>
>>>> ( x below can be index out of bounds if last or listbox is empty )
>>>>
>>>> Any JavaScript tricks, any other Ideas you can think off.
>>>>
>>>> Thank you,
>>>>
>>>>
>>>> Lit
>>>>
>>>>
>>>>
>>>> "Steve" wrote in message
>>>> news:esaHixB5HHA.1208@TK2MSFTNGP03.phx.gbl...
>>>>> I reproduced what you're getting, and fixed it using this code:
>>>>>
>>>>>
>>>>> Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object,
>>>>> ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
>>>>> Dim x As Integer = ListBox1.SelectedIndex
>>>>> ListBox1.Items.Remove(ListBox1.SelectedItem)
>>>>> ListBox1.SelectedIndex = x + 1
>>>>> End Sub
>>>>>
>>>>>
>>>>> Steve C.
>>>>> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
>>>>>
>>>>>
>>>>> Lit wrote:
>>>>>> Hi,
>>>>>>
>>>>>> How can I capture the vertical scroll bar position for a Listbox.
>>>>>>
>>>>>> I have a Listbox of 100 items + when I click on it I post back remove
>>>>>> the item selected.
>>>>>>
>>>>>> After returning to the client browser the list box scroll position is
>>>>>> at the top.
>>>>>>
>>>>>> I want it to be remain in the Proximity of where it was before.
>>>>>>
>>>>>> Can I capture the vertical scroll bar position of a ListBox in
>>>>>> JavaScript and set it?
>>>>>>
>>>>>> Thank you,
>>>>>>
>>>>>> Lit
>>>>>>
>>
Date:Tue, 21 Aug 2007 12:06:26 -0700
Author:
|
Re: Listbox vertical scroll position capture
looking for good JavaScript website, groups out here???? that might help in
this problem?
Thank you,
Lit
"Lit" wrote in message
news:%23i5DamB5HHA.4928@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> How can I capture the vertical scroll bar position for a Listbox.
>
> I have a Listbox of 100 items + when I click on it I post back remove the
> item selected.
>
> After returning to the client browser the list box scroll position is at
> the top.
>
> I want it to be remain in the Proximity of where it was before.
>
> Can I capture the vertical scroll bar position of a ListBox in JavaScript
> and set it?
>
> Thank you,
>
> Lit
>
>
Date:Tue, 21 Aug 2007 13:11:23 -0700
Author:
|
|
|