Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
ASP .Net Datagrid Control
Databinder.Eval passed as argument is choking
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="TJ, post: 4265702"] I have a datagrid that has a boolean column. The sql data is a bit stored as a 1 or 0. Doing a straight up DataBinder.Eval(Container.DataItem, "MyColumn") displays a "True" or "False" in the grid. No problems here. What I want is for it to display a "Yes" or "No". So I'm using a TemplateColumn instead of a BoundColumn so I can pass the value into a function and return a string that says Yes or No. My problem is that the function won't take the value seemingly no matter how I cast or don't cast the argument when I send or in the receiving mechanism of the function. In the aspx page: <asp:TemplateColumn HeaderText="Approved"> <ItemTemplate> <%# FormatYesOrNo(DataBinder.Eval(Container.DataItem, "MyBitColumn")) %> </ItemTemplate> </asp:TemplateColumn> In the code behind: public string FormatYesOrNo(bool x) { string z = "Yes"; if (x != true) z = "No"; return z; } I tried casting the late bound info the aspx to a bool (e.g. (bool)DataBinder.Eval...), but that didn't work. I tried changing the FormatYesOrNo(bool x) in the code behind to FormatYesOrNo(string x) and changing the guts accordingly, but that didn't work. Any help appreciated. -TJ [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
ASP .Net Datagrid Control
Databinder.Eval passed as argument is choking
Top