help plz!! Replace bit value with Image and bind it to repeater

S

sanju

Hi,

I am struggling to replace a bit value 'True' or 'False' with a image
true.gif or false.gif and bind it to a repeater control.

I am getting values 'true' or 'false' depending on whether user is logged in
or not(with asp.net membership provider)

Getting true or false with this <%#
Membership.GetUser(Eval("UserID")).IsOnline %> and

getting the following error with this <%#
(Membership.GetUser(Eval("UserID", "Images/{0}.gif")).IsOnline)%>

plz help me to sort out this issue so that i can display image instead of
true or false.

..................Error details.........................................

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

Line 41:
Line 42:
Line 43: <%# (Membership.GetUser(Eval("UserID",
"Images/{0}.gif")).IsOnline)%> </td>Thanks in advance for helpSanju
 
C

Cowboy \(Gregory A. Beamer\)

<%#
(Membership.GetUser(Eval("UserID", "Images/{0}.gif")).IsOnline)%>

Look at what you are asking here. Think it through for a minute:

Using membership and replace with a graphic by the name of the userid
Check if graphic is online

See a problem.

You are going to have to replace the string first and then bind. Without a
test, I do not have a sample of the code necessary and it might be
problematice even so.

Another option is the GridView (or DataGrid) data binding event, where you
can circumvent the natural order.

Also, how do you have this field set up? Is it templated with an image
control, or are you attempting to replace on the fly? If "on the fly" the
data binding event is your best option.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
 
S

sanju

Hi, I got the solution.
its working properly when i use HTML image control.

Thank you
Sanju
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top