Community-Credit.com | NonProfitWays.com | SOAPitstop.com   Skin:   
      User: Not logged in 
Home
Newsletter Signup
XSLT Library
Latest XML Blogs
Featured Examples
Presentations
Featured Articles
Book Chapters
Training Courses
Events
NewsGroups
 
Discussions
Examples
Tutorials
Tools
Articles
Resources
Websites
 
Sign In
My Profile
My Articles
My Examples
My Favorites
My Resources
Add a Resource
Logout
 
About Me
My Blog
HeadGeek Articles
Talking Portfolio
Resume
Pictures
World Trip Pics

How to bind one datagrid column two fields in asp.net 1.1
Author: Duray AKAR
Published: 11/19/2005 7:24 PM
Category: ASP.NET, C#
Summary: These tricks might be getting old, but still someone could find some use...

 

The asp.net grid is a very good presentation layer tool. Easy to use, powerful, extensible and so on. Most of the customization can be done in the designer, which is another big plus for me.

Windows grid is totally sucks, so I am using a third party grid for winforms, but I never neede a third party grid for asp.net...

But there is one thing that I always needed that is not in the designer. Let's say you will create a dynamic link, but need two fields from the data item, not just one... That means that the URLField, and the URLFormatting alone wouldn't be enough. A little trick that I use in this case :

  1. Create the hyperlink column as if it needs just one field
  2. Convert it to a template column
  3. Switch to HTML view
  4. The NavigateURL should read something like : NavigateUrl='<%# DataBinder.Eval(Container, "DataItem.MyFirstField", "MyLinkedPage.aspx?ID={0}") %>'
  5. Change it to : NavigateUrl='<%# String.Format("MyLinkedPage.aspx?ID={0}&Type={1}", DataBinder.Eval(Container, "DataItem.MyIDField"), , DataBinder.Eval(Container, "DataItem.MyTypeField")) %>'
  6. DONE

:)

Easy , isn't it ?


 

 
Fans of "The Office"
Dwight Bobbleheads are here!
  “It's me! I'm the bobblehead! Yes!”



Advertise on XMLPitstop

Advertise on XMLPitstop


EggHead Cafe
Web Servicee development
DotNetSlackers
Buy text ads here!
online file backup
Color Laser Printer
Gucci sunglasses
Skype vs. sipcall
VoIP Internettelefonie
Buy text ads here!

Interested in Text ads?
2,223 Total Members
36 members(last 30 days)
8 members(last 7 days)
2 members(today)

1,609 Total Discussions
12 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)

17,260 Total Blog Posts
1,839 Blogs(last 30 days)
342 Blogs(last 7 days)
49 Blogs(today)

8,699 Newsgroup Posts
0 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)

13,786 Total Resources
5 Resources(last 30 days)
1 Resources(last 7 days)
0 Resources(today)


 

David Silverlight's XMLPitstop.com| 2801 Florida Ave #225|Miami, FL 33133|Ph:305-447-1139