Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

ASP.NET Listbox Client Side changes not reflected on page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
chandru - 20 Jul 2007 14:58 GMT
Hi,
I am adding some values to the ASP.NET ListControl on the client side
javascript
and this is not reflecting on the server side.
I thought the input and select fields should reflect the changes on
the server side.
I know that the post backs doesn't post all of the HTML only the
changes etc,etc.

I am adding so many values to the list on the client side so I can't
have an hidden input field.
That will make things complex.

Any ideas?
Below is the javascript code,

function OnClientClick_btnAdd()
{
       var listReomveFrom = document.getElementById("ctl00$MainContent
$ListBoxAvailable");
       var listAddTo= document.getElementById("ctl00$MainContent
$ListBoxSelected");

       var iCurrentIndex = listReomveFrom.selectedIndex;
       var iNewOptionIndex = listAddTo.length;

       if (iCurrentIndex != -1)
       {
           listAddTo.options[iNewOptionIndex] = new Option();
           listAddTo.options[iNewOptionIndex].text =
listReomveFrom.options[iCurrentIndex].text;
           listAddTo.options[iNewOptionIndex].value =
listReomveFrom.options[iCurrentIndex].value;
           listAddTo.options[iNewOptionIndex].selected =
listReomveFrom.options[iCurrentIndex].selected;
           listReomveFrom.options[iCurrentIndex --] = null;
       }
}

Thanks,
Chandrasekar Balasubramaniam
bruce barker - 20 Jul 2007 16:32 GMT
the browser only posts back the selected value(s) of a <select>, not the
list. you will need to pass the changes back with some other method (say
a hidden field).

-- bruce (sqlwork.com)

> Hi,
> I am adding some values to the ASP.NET ListControl on the client side
[quoted text clipped - 37 lines]
> Thanks,
> Chandrasekar Balasubramaniam

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.