473,385 Members | 1,465 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,385 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 1084
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" ...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.