d2fox
asked on
how to create a string from a value in datagrid
I have a value in a field that is either 1 or 2. If it's 2, I want to add the word 'Test' to my URL, e.g.
'questiontest.aspx?questio nid=2'
if it's 1 I want to go to
'question.aspx?questionid= 1'
Here's my code currently:
<asp:TemplateField HeaderText="Question" ItemStyle-Width="100px">
<ItemTemplate>
<asp:HyperLink ID="LinkQuestion" runat="server" Text='<%# string.Format("Question {0}", Eval("SortOrder")) %>'
NavigateUrl='<%# string.Format("~/Question{ 2}?questio n={0}&sort ={1}", Eval("QuestionID"), Eval("SortOrder"), ??? %>' />
</ItemTemplate>
</asp:TemplateField>
How can I set the parameter {2} to be 'test' if the question field is 2?
'questiontest.aspx?questio
if it's 1 I want to go to
'question.aspx?questionid=
Here's my code currently:
<asp:TemplateField HeaderText="Question" ItemStyle-Width="100px">
<ItemTemplate>
<asp:HyperLink ID="LinkQuestion" runat="server" Text='<%# string.Format("Question {0}", Eval("SortOrder")) %>'
NavigateUrl='<%# string.Format("~/Question{
</ItemTemplate>
</asp:TemplateField>
How can I set the parameter {2} to be 'test' if the question field is 2?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.