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

Bound Column Question

i have datagrid , I added a bound column and I need to map it with two data
fields ...is this possible?

<asp:datagrid id=dgInbox runat="server" EnableViewState="False"
AutoGenerateColumns="False" AllowSorting="True" Width="100%">
<ItemStyle Wrap="False" BorderWidth="11px" BorderStyle="Solid"
CssClass="tableCell"></ItemStyle>
<HeaderStyle Height="26px" CssClass="tableHeaderCell"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="subject" SortExpression="subject"
HeaderText="Subject"></asp:BoundColumn>

<!-- here i need to map the bound column to second field "name" ...is this
possible" -->
</asp:datagrid>
Nov 19 '05 #1
4 1587
What do you want to achieve? If you want to merge values from two database
fields to one column, you can do it with a TemplateColumn.

Eliyahu

"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
i have datagrid , I added a bound column and I need to map it with two data fields ...is this possible?

<asp:datagrid id=dgInbox runat="server" EnableViewState="False"
AutoGenerateColumns="False" AllowSorting="True" Width="100%">
<ItemStyle Wrap="False" BorderWidth="11px" BorderStyle="Solid"
CssClass="tableCell"></ItemStyle>
<HeaderStyle Height="26px" CssClass="tableHeaderCell"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="subject" SortExpression="subject"
HeaderText="Subject"></asp:BoundColumn>

<!-- here i need to map the bound column to second field "name" ...is this
possible" -->
</asp:datagrid>

Nov 19 '05 #2
I'm retrieving a datatable from a 1st webservice with following structure
(Subject(string),Date(DateTime))

and retrieving a dataset from 2nd webservice with one table of following
structure
(Name(string),Date(DataTime))

I need to list the Subject and Name in same column of datagrid

"Eliyahu Goldin" wrote:
What do you want to achieve? If you want to merge values from two database
fields to one column, you can do it with a TemplateColumn.

Eliyahu

"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
i have datagrid , I added a bound column and I need to map it with two

data
fields ...is this possible?

<asp:datagrid id=dgInbox runat="server" EnableViewState="False"
AutoGenerateColumns="False" AllowSorting="True" Width="100%">
<ItemStyle Wrap="False" BorderWidth="11px" BorderStyle="Solid"
CssClass="tableCell"></ItemStyle>
<HeaderStyle Height="26px" CssClass="tableHeaderCell"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="subject" SortExpression="subject"
HeaderText="Subject"></asp:BoundColumn>

<!-- here i need to map the bound column to second field "name" ...is this
possible" -->
</asp:datagrid>


Nov 19 '05 #3
You can't mix 2 datasources in the same grid. You need to create a DataTable
where you will merge records from 2 datasources in runtime and databind to
this table.

Eliyahu

"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
I'm retrieving a datatable from a 1st webservice with following structure
(Subject(string),Date(DateTime))

and retrieving a dataset from 2nd webservice with one table of following
structure
(Name(string),Date(DataTime))

I need to list the Subject and Name in same column of datagrid

"Eliyahu Goldin" wrote:
What do you want to achieve? If you want to merge values from two database fields to one column, you can do it with a TemplateColumn.

Eliyahu

"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
i have datagrid , I added a bound column and I need to map it with two

data
fields ...is this possible?

<asp:datagrid id=dgInbox runat="server" EnableViewState="False"
AutoGenerateColumns="False" AllowSorting="True" Width="100%">
<ItemStyle Wrap="False" BorderWidth="11px" BorderStyle="Solid"
CssClass="tableCell"></ItemStyle>
<HeaderStyle Height="26px" CssClass="tableHeaderCell"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="subject" SortExpression="subject"
HeaderText="Subject"></asp:BoundColumn>

<!-- here i need to map the bound column to second field "name" ...is this possible" -->
</asp:datagrid>


Nov 19 '05 #4
I did following to merge them to one datatable ...but i seeks better way if any

DataTable dtMerged = new DataTable("MergedTable");
dtMerged.Columns.Add("subject",typeof(string));
dtMerged.Columns.Add("date",typeof(DateTime));
dtMerged.Columns.Add("size",typeof(double));
DataSet dsDoc =oWS1.GetUserFoldersInfo("doc");
DataTable dtMessages = oWS2.GetUsersFolder("doc");
int nRowsCount = dsDoc.Tables[0].Rows.Count;

for(int index = 0 ; index < nRowsCount ; index++)
{
DataRow drDoc = dtMerged.NewRow();

foreach(DataColumn MergedColumn in dtMerged.Columns)
{
if(MergedColumn.ColumnName.Equals("subject"))
{
drDoc[MergedColumn] = dsDoc.Tables[0].Rows[index][0];
}
}

//And so on for the second table
}
"Eliyahu Goldin" wrote:
You can't mix 2 datasources in the same grid. You need to create a DataTable
where you will merge records from 2 datasources in runtime and databind to
this table.

Eliyahu

"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
I'm retrieving a datatable from a 1st webservice with following structure
(Subject(string),Date(DateTime))

and retrieving a dataset from 2nd webservice with one table of following
structure
(Name(string),Date(DataTime))

I need to list the Subject and Name in same column of datagrid

"Eliyahu Goldin" wrote:
What do you want to achieve? If you want to merge values from two database fields to one column, you can do it with a TemplateColumn.

Eliyahu

"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
> i have datagrid , I added a bound column and I need to map it with two
data
> fields ...is this possible?
>
> <asp:datagrid id=dgInbox runat="server" EnableViewState="False"
> AutoGenerateColumns="False" AllowSorting="True" Width="100%">
> <ItemStyle Wrap="False" BorderWidth="11px" BorderStyle="Solid"
> CssClass="tableCell"></ItemStyle>
> <HeaderStyle Height="26px" CssClass="tableHeaderCell"></HeaderStyle>
> <Columns>
> <asp:BoundColumn DataField="subject" SortExpression="subject"
> HeaderText="Subject"></asp:BoundColumn>
>
> <!-- here i need to map the bound column to second field "name" ...is this > possible" -->
> </asp:datagrid>


Nov 19 '05 #5

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

Similar topics

2
by: Daniel Tan | last post by:
Hi, how can i obtain the value of combobox multiple bound column data ? Eg, if i select combo box, it has more than one field, name and age and id listed. Pls advise, thanks. Regards, Daniel
2
by: Ed via AccessMonster.com | last post by:
Hi all, What I am trying to do is get the value of the second column of a bound combo box in vba. example: Combo box: column 1-ID column 2-SIGN_CODE 1 R-1.gif 2 ...
3
by: Cindi Simonson | last post by:
Hi, I have a form with a combo box containing 4 columns of data. The form also contains 3 print buttons where the goal is to open 3 different reports according to the value in one of the...
7
by: Pete Davis | last post by:
A different question this time. I have a DataGrid bound to a collection. Is there any way for me to allow sorting? The DataGrid.AllowSorting=true doesn't work, but that's probably because it can't...
4
by: kaborka | last post by:
I have a WinForm with controls bound to a typed recordset that was generated by the Dataset Designer. There are several ComboBox controls with their DataSource bound to different lookup tables. ...
5
by: njb35 | last post by:
Hi all I'm beginning my foray from VBA into VB 2005 Express, and enjoying some of the efficiencies it provides! I'm stuck with some dataset handling however that I _think_ can be automated but...
2
by: gleadams | last post by:
I have databound a Windows form ComboBox control to a DataSource and DataMember and it is properly showing the data as I navigate through the records. My question concerns the choices in the...
2
by: Vic | last post by:
I have a ArrayList bound to a DataGridView. The objects in de arryalist have 5 propertie but i need only 3 of then in de datagridview. Cane somebody tell me how to prevent that some of the...
0
by: Clare CAVS | last post by:
I have a table with a lookup column referring to another table . tblRooms has two fields, (Autonumber), and . The column I want to display is the RoomName column. If I have Bound Column = 1,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: 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
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.