How to Pass Record Value into Function from GridView or DataView (ASP.NET)
In order to pass a database record value into a custom function of your own from a GridView or DataView in ASP.NET, you will find that you cannot just simply pass the table field's name like it is done with Bind (eg, <%# Bind("fieldname") %>) ).
However, the following code will allow one to successfully pass the record value:
<%# yourFunction( (int) Eval("fieldname") ) %>
Alternatively, one can replace the (int) to (string) or whatnot in order to cast the value to the desired type.
No comments:
Post a Comment