I have a DataTable which has the headings in row 0.
I do the following:
PayDates.DataSo urce=mDt;
PayDates.DataTe xtField= "Pay Date";
PayDates.DataVa lueField="Pay Date";
PayDates.DataBi nd();
PayDates.Items. Insert(0, "Select Date");
But when I look at the DropdownList, the 2nd item, after "Select Date", is
"Pay Date".
How do I tell it not to use row 0?
It obviously knows row 0 is the header row as it uses that to figure out
which column in the table to use.
Thanks,
Tom 4 3661
On Tue, 28 Feb 2006 11:55:02 -0800, "tshad"
<ts**********@f tsolutions.com> wrote: I have a DataTable which has the headings in row 0.
I do the following:
PayDates.DataS ource=mDt; PayDates.DataT extField= "Pay Date"; PayDates.DataV alueField="Pay Date"; PayDates.DataB ind(); PayDates.Items .Insert(0, "Select Date");
But when I look at the DropdownList, the 2nd item, after "Select Date", is "Pay Date".
How do I tell it not to use row 0?
It obviously knows row 0 is the header row as it uses that to figure out which column in the table to use.
Thanks,
Tom
Tom,
what do you mean by 'headings' ?
A datatable has columns (like 'Pay Date' --> which, for obvious
reasons should be called 'PayDate'). You bind the dataset to the
control by it's column name.
Further more: "How do I tell it not to use row 0?"
I guess you mean, that "Select Date" is an invalid option but should
be visible by default?
greetz,
Leon
"Leon Friesema" <le***********@ frostbits.nl> wrote in message
news:l6******** *************** *********@4ax.c om... On Tue, 28 Feb 2006 11:55:02 -0800, "tshad" <ts**********@f tsolutions.com> wrote:
I have a DataTable which has the headings in row 0.
I do the following:
PayDates.Data Source=mDt; PayDates.Data TextField= "Pay Date"; PayDates.Data ValueField="Pay Date"; PayDates.Data Bind(); PayDates.Item s.Insert(0, "Select Date");
But when I look at the DropdownList, the 2nd item, after "Select Date", is "Pay Date".
How do I tell it not to use row 0?
It obviously knows row 0 is the header row as it uses that to figure out which column in the table to use.
Thanks,
Tom
Tom,
what do you mean by 'headings' ? A datatable has columns (like 'Pay Date' --> which, for obvious reasons should be called 'PayDate'). You bind the dataset to the control by it's column name.
My table, similar to what you get back from an sql query, has the title of
the column in row 0 (how else would the value and text field work).
PayDates.DataTe xtField= "Pay Date";
I assume that if I didn't have "Pay Date" in one of the columns in row 0, it
wouldn't be able to do the above command. If I were to bind this to a
datagrid, it is actually putting the row 0 twice (once for the Heading and
once for the 1st row). Not sure why that is, unless there is a way to tell
the datatable that this is a Heading.
I may not be creating the table correctly.
Here is how I am creating the Table:
for(ktr=0;ktr<= rtDataBean.stri ngArray[0].GetUpperBound( 0);ktr++)
{
mDt.Columns.Add (new DataColumn(rtDa taBean.stringAr ray[0][ktr]));
};
for(ktr=0;ktr<= rtDataBean.stri ngArray.GetUppe rBound(0);ktr++ )
{
DataRow mDr = mDt.NewRow();
for (ktr1=0;ktr1<=r tDataBean.strin gArray[0].GetUpperBound( 0);ktr1++)
{
mDr[ktr1] = rtDataBean.stri ngArray[ktr][ktr1];
};
mDr[ktr1] = rtDataBean.stri ngArray[ktr][payDateRow] + " / " +
rtDataBean.stri ngArray[ktr][postDateRow];
mDt.Rows.Add(mD r);
};
The first "for loop" is creating the columns and the second loop creates the
rows and puts the data in the columns.
I think I just figured it out.
I am using row 0 to create the columns for the table and then I am also
using row 0 in the 2nd loop again.
The first loop takes the Data I pass in the .Add method and uses that for
the Column Headings (I think).
Thanks,
Tom Further more: "How do I tell it not to use row 0?" I guess you mean, that "Select Date" is an invalid option but should be visible by default?
greetz, Leon
On Tue, 28 Feb 2006 16:15:36 -0800, "tshad"
<ts**********@f tsolutions.com> wrote: "Leon Friesema" <le***********@ frostbits.nl> wrote in message news:l6******* *************** **********@4ax. com... On Tue, 28 Feb 2006 11:55:02 -0800, "tshad" <ts**********@f tsolutions.com> wrote:
I have a DataTable which has the headings in row 0.
I do the following:
PayDates.Dat aSource=mDt; PayDates.Dat aTextField= "Pay Date"; PayDates.Dat aValueField="Pa y Date"; PayDates.Dat aBind(); PayDates.Ite ms.Insert(0, "Select Date");
But when I look at the DropdownList, the 2nd item, after "Select Date", is "Pay Date".
How do I tell it not to use row 0?
It obviously knows row 0 is the header row as it uses that to figure out which column in the table to use.
Thanks,
Tom
Tom,
what do you mean by 'headings' ? A datatable has columns (like 'Pay Date' --> which, for obvious reasons should be called 'PayDate'). You bind the dataset to the control by it's column name.
My table, similar to what you get back from an sql query, has the title of the column in row 0 (how else would the value and text field work).
PayDates.DataT extField= "Pay Date";
I assume that if I didn't have "Pay Date" in one of the columns in row 0, it wouldn't be able to do the above command. If I were to bind this to a datagrid, it is actually putting the row 0 twice (once for the Heading and once for the 1st row). Not sure why that is, unless there is a way to tell the datatable that this is a Heading.
I may not be creating the table correctly.
Here is how I am creating the Table:
for(ktr=0;ktr< = rtDataBean.stri ngArray[0].GetUpperBound( 0);ktr++) { mDt.Columns.Add (new DataColumn(rtDa taBean.stringAr ray[0][ktr])); };
for(ktr=0;ktr< = rtDataBean.stri ngArray.GetUppe rBound(0);ktr++ ) { DataRow mDr = mDt.NewRow(); for (ktr1=0;ktr1<=r tDataBean.strin gArray[0].GetUpperBound( 0);ktr1++) { mDr[ktr1] = rtDataBean.stri ngArray[ktr][ktr1]; }; mDr[ktr1] = rtDataBean.stri ngArray[ktr][payDateRow] + " / " + rtDataBean.str ingArray[ktr][postDateRow]; mDt.Rows.Add(mD r); };
The first "for loop" is creating the columns and the second loop creates the rows and puts the data in the columns.
I think I just figured it out.
I am using row 0 to create the columns for the table and then I am also using row 0 in the 2nd loop again.
The first loop takes the Data I pass in the .Add method and uses that for the Column Headings (I think).
Thanks,
Tom Further more: "How do I tell it not to use row 0?" I guess you mean, that "Select Date" is an invalid option but should be visible by default?
greetz, Leon
Tom,
start the second for-loop (ktr not ktr1) at 1 not 0, that should do
the trick or otherwise, don't perform the insert after databinding.
greetz,
Leon
"Leon Friesema" <le***********@ frostbits.nl> wrote in message
news:13******** *************** *********@4ax.c om... On Tue, 28 Feb 2006 16:15:36 -0800, "tshad" <ts**********@f tsolutions.com> wrote:
"Leon Friesema" <le***********@ frostbits.nl> wrote in message news:l6****** *************** ***********@4ax .com... On Tue, 28 Feb 2006 11:55:02 -0800, "tshad" <ts**********@f tsolutions.com> wrote:
I have a DataTable which has the headings in row 0.
I do the following:
PayDates.Da taSource=mDt; PayDates.Da taTextField= "Pay Date"; PayDates.Da taValueField="P ay Date"; PayDates.Da taBind(); PayDates.It ems.Insert(0, "Select Date");
But when I look at the DropdownList, the 2nd item, after "Select Date", is "Pay Date".
How do I tell it not to use row 0?
It obviously knows row 0 is the header row as it uses that to figure out which column in the table to use.
Thanks,
Tom
Tom,
what do you mean by 'headings' ? A datatable has columns (like 'Pay Date' --> which, for obvious reasons should be called 'PayDate'). You bind the dataset to the control by it's column name. My table, similar to what you get back from an sql query, has the title of the column in row 0 (how else would the value and text field work).
PayDates.Data TextField= "Pay Date";
I assume that if I didn't have "Pay Date" in one of the columns in row 0, it wouldn't be able to do the above command. If I were to bind this to a datagrid, it is actually putting the row 0 twice (once for the Heading and once for the 1st row). Not sure why that is, unless there is a way to tell the datatable that this is a Heading.
I may not be creating the table correctly.
Here is how I am creating the Table:
for(ktr=0;ktr <= rtDataBean.stri ngArray[0].GetUpperBound( 0);ktr++) { mDt.Columns.Add (new DataColumn(rtDa taBean.stringAr ray[0][ktr])); };
for(ktr=0;ktr <= rtDataBean.stri ngArray.GetUppe rBound(0);ktr++ ) { DataRow mDr = mDt.NewRow(); for (ktr1=0;ktr1<=r tDataBean.strin gArray[0].GetUpperBound( 0);ktr1++) { mDr[ktr1] = rtDataBean.stri ngArray[ktr][ktr1]; }; mDr[ktr1] = rtDataBean.stri ngArray[ktr][payDateRow] + " / " + rtDataBean.st ringArray[ktr][postDateRow]; mDt.Rows.Add(mD r); };
The first "for loop" is creating the columns and the second loop creates the rows and puts the data in the columns.
I think I just figured it out.
I am using row 0 to create the columns for the table and then I am also using row 0 in the 2nd loop again.
The first loop takes the Data I pass in the .Add method and uses that for the Column Headings (I think).
Thanks,
Tom Further more: "How do I tell it not to use row 0?" I guess you mean, that "Select Date" is an invalid option but should be visible by default?
greetz, Leon
Tom,
start the second for-loop (ktr not ktr1) at 1 not 0, that should do the trick or otherwise, don't perform the insert after databinding.
That was it.
Thanks,
Tom greetz, Leon This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stanley J Mroczek |
last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ?
<Columns>
<asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True"
HeaderText="Option Description"></asp:BoundColumn>
<asp:TemplateColumn runat="server" HeaderText="Id Type Option" ">
<itemtemplate>
<asp:label runat="server" Text='<%# DataBinder.Eval(Container.DataItem,
"TypeOption") %>' />
<asp:label runat="server" ID="LlbTypeOption" Visible=False...
|
by: Ravi |
last post by:
I am trying to represent master-detail records from a database
The general logic will be populating the first dropdownlist with the master records and on change of the first dropdownlis
getting the selectedindex and querying the database and populating the childrecords in the second dropdownlist
But my question is how the same can be acheieved by using "Relations"
The following code fragment i tried, but i have no idea how to proceed
...
|
by: Ravi |
last post by:
I am trying to represent master-detail records from a database
The general logic will be populating the first dropdownlist with the master records and on change of the first dropdownlis
getting the selectedindex and querying the database and populating the childrecords in the second dropdownlist
But my question is how the same can be acheieved by using "Relations"
The following code fragment i tried, but i have no idea how to proceed
...
|
by: Tim::.. |
last post by:
Can someone please tell me how I go about preselecting an item in a drop
drown list when I click the Edit Command in a datagrid?
I have tried the following but it doesn't work for me!
I would be really grateful for any assistance!
Thanks
|
by: darrel |
last post by:
I have a asp:dropdownlist set to autopostback.
However, my handler doesn't seem to execute (even though there is a
postback).
Here's the DDL:
<asp:dropdownlist id=ddl_districtSelect runat="server" AutoPostBack="True">
(list items)
</asp:dropdownlist>
| |
by: tshad |
last post by:
Can you databind a dropdownlist to another dropdownlist?
I have 2 identical list. I am getting my data from a DataReader, so as soon
as I have bound the first DDL, I can't do it again to the next as the
dataReader can only be read once.
I tried:
ExperienceLevel.DataSource=dbReader
ExperienceLevel.DataTextField= "Description"
|
by: Santosh |
last post by:
Dear all ,
i am writting following code.
if(Page.IsPostBack==false)
{
try
{
BindSectionDropDownlist();
|
by: mitchman10 |
last post by:
My Time table has TimeID,Employee,PayPeriod,ChargeCodeID,Hours
My Chargecode table has ChargecodeID,c_Text
I need an Editable datagrid that will show the
TimeID,Employee,PayPeriod,C_Text in a label and hours, along with an
edit linkbutton.
When they click on edit, the edit button turns to Update Cancel
TimeID stays read Only
|
by: Anilsg |
last post by:
Hi all,
I have the DropDownList in the FormView,inside InsertTemplateField
The data is binded in run time to it in codebehind page,FOr the First time the page is loaded
the DropdownList is not empty.
when i click on the insert Link the data should be displayed in the gridView (Which is below the formview),
But when i click on the Insert link the data is displayed in the gridView,
But the DropdownList is empty.
Here is the...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |