Tutorials

Welcome to Farid's tutorials,a simple blog that i use to document some nice code pattern that i find useful for my reference in future projects and also to share links that are useful. I do lots of C#/ ASP.NET, MSSQL, bit of R, Python, Arduino, RaspPI, bit of linux and IOS and Android development on a professional/ personal basis. Hope this blog is useful for you as how i find it useful for me.

Wednesday, April 21, 2010

Gridview Customizing Colums with EVAL

So in a gridview you want to combine 2 fields together in presenting the output, or you want to make it appears as


<columns>
<asp:templatefield headertext="No">
<itemtemplate>
<%=countr++%> <%# Eval("Title") %>
</itemtemplate>
</asp:templatefield></columns>




Ensure its <%# and not <%=


Another nicer way to do it:-

                <asp:TemplateField HeaderText="Title">
                <ItemTemplate>
                <%# String.Format("<a href='viewTaskDetail.aspx?id={0}'>{1}</a>",Eval("ID"),Eval("Title")) %>
               
               
                </ItemTemplate>
                </asp:TemplateField>


Posted by Farid at 10:40 PM
Labels: ASP.NET

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Labels

  • ASP.NET (34)
  • Browser (1)
  • CSS (2)
  • Flash (5)
  • FlashCom (2)
  • flex (1)
  • General (9)
  • Hack (1)
  • ios android (1)
  • JQuery (9)
  • LINQ (1)
  • Macro (1)
  • SQL (9)
  • tfs (1)

Blog Archive

About Me

My photo
Farid
Welcome to my profile page, i got a number of blogs, but really the purpose of these blogs are essentially for me, a reference point a place for me to put notes, some place where i can refer. Started a new Windows Mobile Blog, hope i can make some thing cool soon.. HOPE i can build it in C++ *sigh* and not the slow .net frame work.
View my complete profile

visual's shared items

Pages

  • Code Snippets Helper Links
Simple theme. Powered by Blogger.