Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
xzzy #1
multiple data items in each column
How can I display more than one field in a column of a datagrid?
i.e. doing this with old asp and looping thru a recordset it would be
something like:
<table>
do while not eof
<tr>
<td>ABC</td>
<td>DEF</td>
</tr>
<tr>
<td>GHI</td>
<td>JKL</td>
</tr>
read next
loop
</table>
Thank you
xzzy Guest
-
Putting multiple items into a single column in adatagrid
Okay, So I can put information into a datagrid, I can select a row and make sure that it populates that row. I can even make it hit that specific... -
add multiple items to cart
hi all, my detail pg consists of ingredients to a recipe. a repeat region behaviour is added to my table of ingredients. i need to add all the... -
Delete Multiple items with checkboxes
Hello all, I'm sorry for posting this because you probably answered this question a million times, but i didn't got my script to run yet. I'm... -
AS2 help: manipulate properties of multiple items
The mission: create multiple MCs (see the attachment) of a library item (a ball) that is linked with a class. At runtime, if user presses "q", ALL... -
Select multiple items from a dropdown
I want an ASP page with a dropdown and a simple button. Every time the user chooses an item from the dropdown and clicks on the button i want that... -
Zach Wells #2
Re: multiple data items in each column
I've never done it but I'd suspect that you could use an item template
column and then just put the following code in there:
<ItemTemplate>
<asp:Label id=Label1
runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "FieldName1") %>'>
</asp:Label>
<asp:Label id=Label1
runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "FieldName2") %>'>
</asp:Label>
</ItemTemplate>
Zach
xzzy wrote:> How can I display more than one field in a column of a datagrid?
>
> i.e. doing this with old asp and looping thru a recordset it would be
> something like:
>
> <table>
> do while not eof
> <tr>
> <td>ABC</td>
> <td>DEF</td>
> </tr>
> <tr>
> <td>GHI</td>
> <td>JKL</td>
> </tr>
> read next
> loop
> </table>
>
> Thank you
>
>Zach Wells Guest
-
Scott Mitchell [MVP] #3
Re: multiple data items in each column
Zach Wells wrote:
While this will definitely display two records in one table row, it will>>> How can I display more than one field in a column of a datagrid?
> I've never done it but I'd suspect that you could use an item template
> column and then just put the following code in there:
>
> <ItemTemplate>
> <asp:Label id=Label1
> runat="server"
> Text='<%# DataBinder.Eval(Container.DataItem, "FieldName1") %>'>
> </asp:Label>
> <asp:Label id=Label1
> runat="server"
> Text='<%# DataBinder.Eval(Container.DataItem, "FieldName2") %>'>
> </asp:Label>
> </ItemTemplate>
not generate the HTML the original poster was interested in. Namely, it
won't necessarily have the second Label's value line up in each row, as
it would with the desired HTML provided originally.
To get the HTML rendered as specified in the original post, one would
need to use a DataList with RepeatColumns set to 2, or a Repeater,
generating the apporpriate HTML markup.
To learn more about the three Data Web controls check out:
Deciding When to Use the DataGrid, DataList, or Repeater
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnet-whenusedatawebcontrols.asp[/url]
Or check out my book, ASP.NET Data Web Controls Kick Start
[[url]http://www.amazon.com/exec/obidos/ASIN/0672325012/4guysfromrollaco][/url]
Happy Programming!
--
Scott Mitchell
[email]mitchell@4guysfromrolla.com[/email]
[url]http://www.4GuysFromRolla.com[/url]
[url]http://www.ASPFAQs.com[/url]
[url]http://www.ASPMessageboard.com[/url]
* When you think ASP, think 4GuysFromRolla.com!
Scott Mitchell [MVP] Guest



Reply With Quote

