Click here to Skip to main content
15,906,645 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHi Every Body.... Pin
Gaurav Lal30-Aug-06 22:42
Gaurav Lal30-Aug-06 22:42 
AnswerHi Dr Nick Pin
J4amieC30-Aug-06 23:28
J4amieC30-Aug-06 23:28 
AnswerRe: Hi Every Body.... Pin
psamy31-Aug-06 2:04
psamy31-Aug-06 2:04 
AnswerRe: Hi Every Body.... Pin
Kartik Rathi31-Aug-06 2:06
Kartik Rathi31-Aug-06 2:06 
GeneralRe: Hi Every Body.... Pin
J4amieC31-Aug-06 2:59
J4amieC31-Aug-06 2:59 
QuestionTyping URL vs Clicking on Hyperlink Pin
Shades11130-Aug-06 22:17
Shades11130-Aug-06 22:17 
QuestionGridview TemplateField Pin
Brendan Vogt30-Aug-06 22:11
Brendan Vogt30-Aug-06 22:11 
AnswerRe: Gridview TemplateField Pin
John Petersen30-Aug-06 22:54
John Petersen30-Aug-06 22:54 
Hello ma se

There are different ways of doing this. One way is to create a method in the code behind file that returns the value that you want to display. So you replace your "Insert / Update Items" part with a method call as the sample below. You can send any data to this method for it to be able to return the right value. Remember to make the method protected, otherwise you cant use it from the aspx page.

<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<a href='UpdateOrderItems.aspx?OrderID=<%# DataBinder.Eval(Container.DataItem, "ID") %>'><%# GetUrlActionText( DataBinder.Eval(Container.DataItem, "ID") %></a>
</ItemTemplate>
<HeaderStyle CssClass="GridViewHeader" />
<ItemStyle CssClass="GridViewCell" />
</asp:TemplateField>

// Put in code behind file
protected string GetUrlActionText(string id)
{
// Code to return either Insert / Update Items or View
bool isOrdered = GetOrderIsPlaced(id);
if (isOrdered)
return "View";
else
return "Insert / Update Items";
}


Another way is to make the check in the aspx file.


<% if (orderPlaced == true) { %>
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<a href='UpdateOrderItems.aspx?OrderID=<%# DataBinder.Eval(Container.DataItem, "ID") %>'>View</a>
</ItemTemplate>
<HeaderStyle CssClass="GridViewHeader" />
<ItemStyle CssClass="GridViewCell" />
</asp:TemplateField
<% } else { %>
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<a href='UpdateOrderItems.aspx?OrderID=<%# DataBinder.Eval(Container.DataItem, "ID") %>'>Insert / Update Items</a>
</ItemTemplate>
<HeaderStyle CssClass="GridViewHeader" />
<ItemStyle CssClass="GridViewCell" />
</asp:TemplateField>
<% } %>

the orderPlaced variable is a protected variable in the code behind class that contains the state of the order.

I hope this helps you out.


Kind Regards,

John Petersen
QuestionAdd content files to set up project Pin
Arch22k30-Aug-06 21:50
Arch22k30-Aug-06 21:50 
QuestionUnable to connect remote server Pin
King Shez30-Aug-06 20:58
King Shez30-Aug-06 20:58 
AnswerRe: Unable to connect remote server Pin
mbbisht30-Aug-06 21:28
mbbisht30-Aug-06 21:28 
QuestionDropDown list event issue... Pin
fishy_130-Aug-06 20:50
fishy_130-Aug-06 20:50 
AnswerRe: DropDown list event issue... Pin
MIHAI_MTZ30-Aug-06 22:24
MIHAI_MTZ30-Aug-06 22:24 
GeneralRe: DropDown list event issue... Pin
fishy_130-Aug-06 22:45
fishy_130-Aug-06 22:45 
GeneralRe: DropDown list event issue... Pin
MIHAI_MTZ30-Aug-06 22:52
MIHAI_MTZ30-Aug-06 22:52 
QuestionTransection Problem Pin
monika_vasvani30-Aug-06 20:48
monika_vasvani30-Aug-06 20:48 
AnswerRe: Transection Problem Pin
Coding C#30-Aug-06 23:56
Coding C#30-Aug-06 23:56 
QuestionReading contents of HTML email template Pin
anu8130-Aug-06 20:18
anu8130-Aug-06 20:18 
QuestionProblem in sending Mail ASP.NET Pin
Exelioindia30-Aug-06 20:17
Exelioindia30-Aug-06 20:17 
AnswerRe: Problem in sending Mail ASP.NET Pin
Guffa30-Aug-06 21:18
Guffa30-Aug-06 21:18 
GeneralRe: Problem in sending Mail ASP.NET Pin
Exelioindia30-Aug-06 21:55
Exelioindia30-Aug-06 21:55 
GeneralRe: Problem in sending Mail ASP.NET Pin
Guffa31-Aug-06 11:20
Guffa31-Aug-06 11:20 
GeneralRe: Problem in sending Mail ASP.NET Pin
Exelioindia31-Aug-06 19:46
Exelioindia31-Aug-06 19:46 
AnswerRe: Problem in sending Mail ASP.NET Pin
Guffa1-Sep-06 7:42
Guffa1-Sep-06 7:42 
GeneralRe: Problem in sending Mail ASP.NET Pin
Exelioindia1-Sep-06 19:03
Exelioindia1-Sep-06 19:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.