473,322 Members | 1,714 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,322 software developers and data experts.

Problem with Web Control Binding

I have a drop down control that I've added a list item that has a value of
zero and the text name is "[Select One]". And it shows up like it's
supposed to until I bind a dataset to it. The binding seems to remove the
list Item that I added. Is there something I have to set to keep the list
Item that I added via ASPX code? Has anyone been successful in having a
defuatl selection that is not in the data set?

ASPX code:
<asp:DropDownList id="cboConferenceID" runat="server" AutoPostBack="True">
<asp:ListItem Value="0">[Select One]</asp:ListItem>
</asp:DropDownList>

ASP C# code-behind:
this.cboConferenceID.DataSource = dsGeneric;
this.cboConferenceID.DataTextField = vstrDataTextField;
this.cboConferenceID.DataValueField = vstrDataValueField;
this.cboConferenceID.DataBind();

Thanks in advance,
Andrea

PS: VS.NET 2003 on WIN 2000
Nov 18 '05 #1
2 1031
in the codebehind, add it after the bind

-- bruce (sqlwork.com)
"Andrea Williams" <an*******@hotmail.IHATESpam.com> wrote in message
news:#x**************@TK2MSFTNGP11.phx.gbl...
I have a drop down control that I've added a list item that has a value of
zero and the text name is "[Select One]". And it shows up like it's
supposed to until I bind a dataset to it. The binding seems to remove the
list Item that I added. Is there something I have to set to keep the list
Item that I added via ASPX code? Has anyone been successful in having a
defuatl selection that is not in the data set?

ASPX code:
<asp:DropDownList id="cboConferenceID" runat="server" AutoPostBack="True">
<asp:ListItem Value="0">[Select One]</asp:ListItem>
</asp:DropDownList>

ASP C# code-behind:
this.cboConferenceID.DataSource = dsGeneric;
this.cboConferenceID.DataTextField = vstrDataTextField;
this.cboConferenceID.DataValueField = vstrDataValueField;
this.cboConferenceID.DataBind();

Thanks in advance,
Andrea

PS: VS.NET 2003 on WIN 2000

Nov 18 '05 #2
So I'm guessing that this behavior is by design??

I was able to Insert a row after the bind and that works!

Thanks!
Andrea
"bruce barker" <no***********@safeco.com> wrote in message
news:uI**************@tk2msftngp13.phx.gbl...
in the codebehind, add it after the bind

-- bruce (sqlwork.com)
"Andrea Williams" <an*******@hotmail.IHATESpam.com> wrote in message
news:#x**************@TK2MSFTNGP11.phx.gbl...
I have a drop down control that I've added a list item that has a value of zero and the text name is "[Select One]". And it shows up like it's
supposed to until I bind a dataset to it. The binding seems to remove the list Item that I added. Is there something I have to set to keep the list Item that I added via ASPX code? Has anyone been successful in having a
defuatl selection that is not in the data set?

ASPX code:
<asp:DropDownList id="cboConferenceID" runat="server" AutoPostBack="True"> <asp:ListItem Value="0">[Select One]</asp:ListItem>
</asp:DropDownList>

ASP C# code-behind:
this.cboConferenceID.DataSource = dsGeneric;
this.cboConferenceID.DataTextField = vstrDataTextField;
this.cboConferenceID.DataValueField = vstrDataValueField;
this.cboConferenceID.DataBind();

Thanks in advance,
Andrea

PS: VS.NET 2003 on WIN 2000


Nov 18 '05 #3

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

Similar topics

5
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order...
3
by: Elliot Rodriguez | last post by:
Hi: I am writing a WinForm app that contains a DataGrid control and a StatusBar control. My goal is to update the status bar using events from a separate class, as well as some other simple...
3
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls...
3
by: funkyMonkey | last post by:
I'm binding date fields from entity objects and formatting the output in the text box in short date format. Code: BindDateField(Me.txtCheckIn, "Text", reservation.BookingDetail, "CheckIn")...
0
by: AMDRIT | last post by:
Hello everyone, VB2003-Winforms I have a class object (testclass), that I would like to bind parts of to two custom controls (control1 and control2). The testclass is stored in a hash table...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
0
by: AleXmanFree | last post by:
Hi, I have this kind of problem, In my asp.net page i use DataList and user control that is repeated in DataList. This user control has in it a checkbox , so everytime user clicks on checkbox...
7
by: Vlado Jasovic | last post by:
Hello, I'm using typed dataset for databinding to windows controls and I'm having some problems. I'm trying to move all business logic to datatable column_changing events and the problem that...
3
by: Tomasz J | last post by:
Hello Developers, I have a control derived from System.Web.UI.WebControls.WebControl. Control has this property: public string Value { set { _value = value; } get { return _value; }
0
by: furqanms | last post by:
Hello, I am new to WPF ,I am developing touch screen system using WPF. I am facing problem in Binding relative reference. Here is my code : <UserControl x:Class="uctlBrowser" ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.