Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > DropDown List

Reply
Thread Tools

DropDown List

 
 
Manoj Paramu Das
Guest
Posts: n/a
 
      02-10-2005
DropDwonList.SelectedItem.Value returns only the first record value, no
matter when you select. any help would be appreciated.

Thnaks Manoj


 
Reply With Quote
 
 
 
 
ranganh
Guest
Posts: n/a
 
      02-11-2005
Dear Manoj,

You must be having the postback issue. check my article on this.

http://aspnet_harish.blogspot.com/20...-postback.html

If it doesnt help, write back.

Thanks.

"Manoj Paramu Das" wrote:

> DropDwonList.SelectedItem.Value returns only the first record value, no
> matter when you select. any help would be appreciated.
>
> Thnaks Manoj
>
>
>

 
Reply With Quote
 
 
 
 
Sean McKaharay
Guest
Posts: n/a
 
      02-14-2005
Read this excerpt:


Adding Controls at the Right Time
We already know that when adding controls dynamically through the page's
code portion the controls must be added on every postback. But when in the
page lifecycle should the controls be added? At first guess, we might decide
to put such code in the Page_Load event handler, causing the controls to be
added during the Load stage of the page's lifecycle. This would work fine if
we don't need to worry about saving the controls' view state across
postbacks, but if we do need to persist the view state of the dynamically
added controls the Load stage is not where we should be adding these
controls.

If we need our dynamically added controls to maintain their view state it is
paramount that these controls be added before the Load View State stage.
That is, these controls must exist within the page's control hierarchy
before the view state is loaded. There's only one stage before Load View
State - Initialization. That means, if we want our dynamic controls to
persist view state we must add them to the control hierarchy in the page's
Init event.

If you are using Visual Studio .NET, the code-behind class already contains
an event handler for the page's Init event. This event handler (named
Page_Init in VB.NET code-behind classes and OnInit in C# code-behind
classes) is tucked away in the hidden "Web Form Designer Generated Code"
region. What I typically do is create a separate method in the code-behind
class and simply call this method from the Init event handler. Once you have
configured everything so that the dynamic controls are added during the
Initialization stage, you can then read/write the controls' properties in
the Load stage. You'll find that the users' interactions with the dynamic
controls remains "remembered" across postbacks if you follow this pattern.



That should help,











"Manoj Paramu Das" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> DropDwonList.SelectedItem.Value returns only the first record value, no
> matter when you select. any help would be appreciated.
>
> Thnaks Manoj
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
1 Gridview. Dropdown A is column from database, Dropdown B is column from database, Data in A and B must be from same row. anonymoushamster@gmail.com ASP .Net 2 11-07-2007 12:40 PM
ajax cascading dropdown: second dropdown disabled acadam ASP .Net 0 12-27-2006 10:59 AM
bind a dropdown in a column in a datagrid based on the dropdown value selected in another column of the datagrid. vishnu ASP .Net 1 03-25-2006 01:24 PM
Select dropdown box bleeds into Javascript dropdown menu Mike HTML 1 12-18-2003 09:49 PM
Edit Mode - How do I populate dropdown in edittemplate from dropdown in another column? Steve Myers ASP .Net Datagrid Control 2 11-20-2003 01:09 PM



Advertisments