Link to home
Start Free TrialLog in
Avatar of d2fox
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?questionid=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}?question={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?
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial