listbox goes top during postback in asp.net c#

Posted by Prabu_Spark under ASP.NET on 9/9/2014 | Points: 10 | Views : 497 | Status : [Member] | Replies : 2
Hi sir,
I have a listbox that contains 30 items in the list and set the autopostback to true. During the postback, listbox goes to top position.

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: Naveenhcl on: 9/9/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,

I can't able to understand your problem.

I think during postback your controls are skewing right.?

If this is your problem then Go to AJAX Controls and use UpdatePanel, this will give you proper alignment after postback.

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabu_Spark on: 9/9/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,
I placed the listbox inside the update panel, it i select the 20th item in listbox , i set autopostback to true, because of this property it will goes to top position of listbox. My problem is how to maintain the selected position of listbox during autopostback event. Kindly give me the solution for this problem.


<asp:UpdatePanel ID="updatepanel1" runat="server">
<ContentTemplate>
<table>

<tr>

<td class="lbl">
School Name
</td>
<td>
<asp:ListBox ID="list_schoolname" AutoPostBack="true" CssClass="ctr150" Height="200px" Width="250px"
SelectionMode="Multiple" runat="server" onchange="lstSelection();"
onselectedindexchanged="list_schoolname_SelectedIndexChanged"></asp:ListBox>
</td>

</tr>
</table>

</ContentTemplate>
</asp:UpdatePanel>

With regards,
J.Prabu.
[Email:prbspark@gmail.com]

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response