Databinding "Bind()" in ASP.NET#

If you used the developemt tools to create a datagrid in ASP.NET 2.0, it will show something like:

NavigateUrl='<%# Bind("EmployeeId") %>'

But what if you wanted to do something more complicated that just ge the EmployeeId into the field, like for example if you wanted to run a JS function.  Then you have to do away with Bind and use the more verbose DataBinder method like this: 

NavigateUrl='<%# "javascript:UseThisJobIndex(" & DataBinder.Eval(Container.DataItem,"JobIndex") & ")" %>'

That's all there is to it.

 

Categories:  |  |  | 
Thursday, August 24, 2006 12:16:56 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Name
E-mail
(will show your gravatar icon)
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

All content © 2008, Christopher May, Inc
Open Job Positions
On this page
Google Ads
This site
Calendar
<August 2006>
SunMonTueWedThuFriSat
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789
Archives
Sitemap
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 1.9.6264.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts


Pick a theme: