Re: Datagrid runtime expressions

Discussion in 'ASP .Net' started by John Saunders, Aug 30, 2003.

  1. "Olle de Zwart" <> wrote in message
    news:001f01c36f03$9e5d1030$...
    > Hello,
    >
    > I am trying to get the Request.ApplicationPath into a
    > link inside my datagrid for some reason the expression
    > doesn't get executed but translated into HTML any ideas?
    >
    > the code is:
    >
    > <asp:DataGrid id="dgArticles" runat="server"
    > AllowPaging="True" BorderColor="#CC9966"
    > BorderStyle="None"
    > BorderWidth="1px" BackColor="White"
    > CellPadding="4" AllowSorting="True">
    > <SelectedItemStyle Font-Bold="True"
    > ForeColor="#663399"
    > BackColor="#FFCC66"></SelectedItemStyle>
    > <ItemStyle ForeColor="#330099"
    > BackColor="White"></ItemStyle>
    > <HeaderStyle Font-Bold="True"
    > ForeColor="#FFFFCC" BackColor="#990000"></HeaderStyle>
    > <FooterStyle ForeColor="#330099"
    > BackColor="#FFFFCC"></FooterStyle>
    > <Columns>
    > <asp:BoundColumn DataField="id"
    > HeaderText="article id"></asp:BoundColumn>
    > <asp:BoundColumn
    > DataField="title" HeaderText="title"></asp:BoundColumn>
    > <asp:HyperLinkColumn Text="edit"
    > DataNavigateUrlField="id" DataNavigateUrlFormatString="<%
    > = Request.ApplicationPath%>
    > administration/EditArticle.aspx?aid=
    > {0}"></asp:HyperLinkColumn>
    > <asp:HyperLinkColumn
    > Text="delete"
    > DataNavigateUrlField="id"></asp:HyperLinkColumn>
    > </Columns>
    > <PagerStyle HorizontalAlign="Center"
    > ForeColor="#330099" BackColor="#FFFFCC"></PagerStyle>
    > </asp:DataGrid>


    In your post, it looks like you may have space between the "%" and the "=".
    If so, make it "<%= expression %>".
    --
    John Saunders
    Internet Engineer
     
    John Saunders, Aug 30, 2003
    #1
    1. Advertising


  2. >-----Original Message-----
    >"Olle de Zwart" <> wrote in message
    >news:001f01c36f03$9e5d1030$...
    >> Hello,
    >>
    >> I am trying to get the Request.ApplicationPath into a
    >> link inside my datagrid for some reason the expression
    >> doesn't get executed but translated into HTML any

    ideas?
    >>
    >> the code is:
    >>
    >> <asp:DataGrid id="dgArticles" runat="server"
    >> AllowPaging="True" BorderColor="#CC9966"
    >> BorderStyle="None"
    >> BorderWidth="1px" BackColor="White"
    >> CellPadding="4" AllowSorting="True">
    >> <SelectedItemStyle Font-Bold="True"
    >> ForeColor="#663399"
    >> BackColor="#FFCC66"></SelectedItemStyle>
    >> <ItemStyle ForeColor="#330099"
    >> BackColor="White"></ItemStyle>
    >> <HeaderStyle Font-Bold="True"
    >> ForeColor="#FFFFCC" BackColor="#990000"></HeaderStyle>
    >> <FooterStyle ForeColor="#330099"
    >> BackColor="#FFFFCC"></FooterStyle>
    >> <Columns>
    >> <asp:BoundColumn DataField="id"
    >> HeaderText="article id"></asp:BoundColumn>
    >> <asp:BoundColumn
    >> DataField="title" HeaderText="title"></asp:BoundColumn>
    >> <asp:HyperLinkColumn Text="edit"
    >> DataNavigateUrlField="id"

    DataNavigateUrlFormatString="<%
    >> = Request.ApplicationPath%>
    >> administration/EditArticle.aspx?aid=
    >> {0}"></asp:HyperLinkColumn>
    >> <asp:HyperLinkColumn
    >> Text="delete"
    >> DataNavigateUrlField="id"></asp:HyperLinkColumn>
    >> </Columns>
    >> <PagerStyle HorizontalAlign="Center"
    >> ForeColor="#330099" BackColor="#FFFFCC"></PagerStyle>
    >> </asp:DataGrid>

    >
    >In your post, it looks like you may have space between

    the "%" and the "=".
    >If so, make it "<%= expression %>".
    >--
    >John Saunders
    >Internet Engineer
    >
    >
    >
    >.
    >

    No there is no space. Any other ideas?
     
    O.S. de Zwart, Aug 30, 2003
    #2
    1. Advertising

  3. "O.S. de Zwart" <> wrote in message
    news:016601c36f35$63dc07e0$...
    >
    > No there is no space. Any other ideas?


    Yes. What happens when you use "<%= 1 %>"?

    Also, if you're just trying to reference the current application, I think
    that "~" will do it for you. "~/default.aspx" is the default.aspx in the
    root of the application.
    --
    John Saunders
    Internet Engineer
     
    John Saunders, Aug 30, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jay Douglas
    Replies:
    0
    Views:
    610
    Jay Douglas
    Aug 15, 2003
  2. reiks

    datagrid-expressions

    reiks, Dec 6, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    734
  3. Hal Vaughan
    Replies:
    11
    Views:
    1,130
    Gordon Beaton
    May 22, 2006
  4. dotNetProfessional

    Examining Bind expressions at runtime

    dotNetProfessional, Oct 27, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    111
    dotNetProfessional
    Oct 27, 2006
  5. Noman Shapiro
    Replies:
    0
    Views:
    235
    Noman Shapiro
    Jul 17, 2013
Loading...

Share This Page