Monday, March 26, 2012
Populate a Listbox by using JavaScript
I have a page with a ListBox on it, and It's also have a some buttons to
populate the ListBox by using JavaScript.
I have no problem with populate the listbox using JavaScript. But when the
page is submited / postback, the listbox is still empty.
Do you have any solution for this case (if I still want to use ListBox
Server Control) ?
thanks,
Devin WoodDevin,
You need to pass the new items to the server. It can be done in a hidden
input html control. On server side you will parse the input's value and
populate the listbox.
Eliyahu
"Devin Wood" <nordlitch@.msn.com> wrote in message
news:Opwr1avLFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hi,
> I have a page with a ListBox on it, and It's also have a some buttons to
> populate the ListBox by using JavaScript.
> I have no problem with populate the listbox using JavaScript. But when the
> page is submited / postback, the listbox is still empty.
> Do you have any solution for this case (if I still want to use ListBox
> Server Control) ?
> thanks,
> Devin Wood
>
Populate a Listbox by using JavaScript
I have a page with a ListBox on it, and It's also have a some buttons to
populate the ListBox by using JavaScript.
I have no problem with populate the listbox using JavaScript. But when the
page is submited / postback, the listbox is still empty.
Do you have any solution for this case (if I still want to use ListBox
Server Control) ?
thanks,
Devin WoodDevin,
You need to pass the new items to the server. It can be done in a hidden
input html control. On server side you will parse the input's value and
populate the listbox.
Eliyahu
"Devin Wood" <nordlitch@.msn.com> wrote in message
news:Opwr1avLFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hi,
> I have a page with a ListBox on it, and It's also have a some buttons to
> populate the ListBox by using JavaScript.
> I have no problem with populate the listbox using JavaScript. But when the
> page is submited / postback, the listbox is still empty.
> Do you have any solution for this case (if I still want to use ListBox
> Server Control) ?
> thanks,
> Devin Wood
Saturday, March 24, 2012
Populate Dropdown with File Names
populate a Dropdown with the File Names that reside in an image folder
that's in the same project. So far all I've been able to find is the
below code...and even then that's not quite what I'm after.
DirectoryInfo di = new DirectoryInfo(@dotnet.itags.org."~/Images/Entry/");
FileInfo[] fis = di.GetFiles();
DropDownList5.DataSource = fis;
DropDownList5.DataTextField = "Name";
DropDownList5.DataValueField = "Name";
DropDownList5.DataBind();
Any help in trying to get this resolved quickly would be appreciated.
ThanksOne thing I neglected to say...the Dropdown will also reside in the
EditItemTemplate of a Formview. Is there a way to bind that control if
it's there?
Thanks Again
Dave wrote:
Quote:
Originally Posted by
I'm working with an ASP.Net web page that's using C#. I'm trying to
populate a Dropdown with the File Names that reside in an image folder
that's in the same project. So far all I've been able to find is the
below code...and even then that's not quite what I'm after.
>
DirectoryInfo di = new DirectoryInfo(@."~/Images/Entry/");
FileInfo[] fis = di.GetFiles();
DropDownList5.DataSource = fis;
DropDownList5.DataTextField = "Name";
DropDownList5.DataValueField = "Name";
DropDownList5.DataBind();
>
Any help in trying to get this resolved quickly would be appreciated.
>
Thanks