<label id="mediaLink"><a href="requestDetail.aspx?s
That should place the value for that row for that field exactly where you put it in the itemtemplate
Main Topics
Browse All TopicsI created a gridview that renders 5 columns to a page.
In the last column, the data that is rendered is based on
data from a column data in a table. Also, I want the last column to be
a link as a querystring. I'm a little confused b/c my codebehind
is on a different page. In PHP, b/c the script and html were on the
same page, it was easier. Below I have PHP code and I just want to
do the same in ASP.NET. I also have the ASP.NET and my codebehind (C#) below.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
OK. I did a little bit more research and used a dataTable because I needed the id in my queryString, so I modified my code some and got stuck.
How can I use the information in my dataTable (drInsert["ReqID"],drInser
Also, I get a blue squigly linke under "foreach" that says, "foreach statement cannot operate on variables of type 'System.Data.DataTable' becuase 'System.Data.DataTable' does not contain a public definition for 'GetEnumerator'".
How do I resolve that?
Thanks.
FYI. The foreach message your getting is because a DataTable isn't a collection of rows, a DataTable HAS a collection of rows that you could itterate though like:
foreach (DataRow dr in media.Tables[0].Rows)
{
...
}
I don't believe this is how you want to do it though. I'll re-work some code and post it in a bit.
It says I'm missing an assembly. Below are the errors
Error 5 The type or namespace name 'Page' could not be found (are you missing a using directive or an assembly reference?) D:\Documents and Settings\My Documents\Visual Studio 2008\Projects\RequestMedia
Error 6 The type or namespace name 'EventArgs' could not be found (are you missing a using directive or an assembly reference? D:\Documents and Settings\My Documents\Visual Studio 2008\Projects\RequestMedia
Ok. I see. not your fault...should have known.
Anyway, now I get a compilation error on line 39
--------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1501: No overload for method 'GetStatusLink' takes '1' arguments
Source Error:
Line 37: <asp:templatefield>
Line 38: <ItemTemplate>
Line 39: <% GetStatusLink(Eval("medCop
Line 40: </ItemTemplate>
Line 41: </asp:templatefield>
You might try changing the line to read:
<% GetStatusLink(DataBinder.E
And see if it makes a difference.
http://aspadvice.com/blogs
Business Accounts
Answer for Membership
by: locke_aPosted on 2009-09-29 at 11:46:15ID: 25451999
In your item template you can call a method that will evaluate the data and return a string, like:
atusID"))% >
<itemTemplate>
<%#GetMediaLink(Eval("medSt
</itemTemplate>
Then in your code behind:
public string GetMediaLink(string statusID)
{
//Do Whatever if statements etc
return "<a href=...";
}