By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,644 Members | 1,866 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,644 IT Pros & Developers. It's quick & easy.

How to show two field at once

P: n/a
ad
I want to show two field in a column of Gridview.
I use the code :
But it only show Bind("InjectDate")

How can I show two field at once in a Template?

<ItemTemplate>
<asp:Label ID="Label1" runat="server"
Text='<%# Bind("InjectC") + Bind("InjectDate")%>'></asp:Label>
</ItemTemplate>
May 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
If you are not seeing InjectC it probably means that InjectC is evaluating
to an empty string. I would suggest creating a method in your class
something like this:

protected string GetInjectCANDInjectDate(string injectC, DateTime
injectDate)

{

string str = injectC + injectDate.ToString();

return str;

}

and then in your aspx file put:

Text='<%# (string) GetInjectCANDInjectDate((string)
Eval("InjectC"),(DateTime) Eval("InjectDate")) %>' >

Put a debug statement in your new method GetInjectCANDInjectDate

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:ed**************@TK2MSFTNGP03.phx.gbl...
I want to show two field in a column of Gridview.
I use the code :
But it only show Bind("InjectDate")

How can I show two field at once in a Template?

<ItemTemplate>
<asp:Label ID="Label1" runat="server"
Text='<%# Bind("InjectC") + Bind("InjectDate")%>'></asp:Label>
</ItemTemplate>

May 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.