473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Problem with dropdownlis(beginner)

Hi
I have problem :)
//ds is fill data

DropDownList1.DataSource = ds;
DropDownList1.DataTextField = ds.Tables[0].Columns["username"].ToString();

DropDownList1.DataValueField = ds.Tables[0].Columns["pkid"].ToString();

DropDownList1.DataBind();

when I whant DropDownList.SelectItem.text selected item is always first
username ?? why ??

I will by very grateful for any help

thens


Nov 18 '05 #1
1 1220
Because you are rebinding the value on postback, wrap the code below in an

if (!Page.IsPostBack) {
....code here
}

by rebinding all values are being reset

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Eiffla" <ei******@wp.pl> wrote in message
news:ci**********@nemesis.news.tpi.pl...
Hi
I have problem :)
//ds is fill data

DropDownList1.DataSource = ds;
DropDownList1.DataTextField = ds.Tables[0].Columns["username"].ToString();

DropDownList1.DataValueField = ds.Tables[0].Columns["pkid"].ToString();

DropDownList1.DataBind();

when I whant DropDownList.SelectItem.text selected item is always first
username ?? why ??

I will by very grateful for any help

thens

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jvax | last post by:
Hi all, I hope I'm posting in the right NG... I have a data text file I want to read from a c++ program. the data file goes like this: 90 # number of balls 33 42 13
3
by: Larry Smith | last post by:
I'm just doing some experimentation to learn the ins and outs of resources in .NET and am having a minor problem (OS=Win2000). I've prepared both an "en-US" subdirectory and an "en-CA" subdirectory...
1
by: David | last post by:
I have developed a very simple aspx that simply looks like: <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApps1.WebForm1" aspCompat="True"%> <!DOCTYPE...
17
by: Mitas Nikos | last post by:
I am trying to use the library conio2 and though I have managed with a few relatively simple examples when i try to compile a program which conio's function clrscr is not in main() i get an error...
18
by: mitchellpal | last post by:
Hi guys, am learning c as a beginner language and am finding it rough especially with pointers and data files. What do you think, am i being too pessimistic or thats how it happens for a beginner?...
20
by: weight gain 2000 | last post by:
Hello all! I'm looking for a very good book for an absolute beginner on VB.net or VB 2005 with emphasis on databases. What would you reccommend? Thanks!
5
by: macca | last post by:
Hi, I'm looking for a good book on PHP design patterns for a OOP beginner - Reccommendations please? Thanks Paul
10
by: Roman Zeilinger | last post by:
Hi I have a beginner question concerning fscanf. First I had a text file which just contained some hex numbers: 0C100012 0C100012 ....
22
by: ddg_linux | last post by:
I have been reading about and doing a lot of php code examples from books but now I find myself wanting to do something practical with some of the skills that I have learned. I am a beginner php...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.