Home > Net >  Asp.net to ask a question about listview
Asp.net to ask a question about listview

Time:10-10


Meet a problem when I learning listview,
Now want to the effect of implementation is

123 & lt;/td>
The exam a [normal]


124 & lt;/td>
The examination room 2 [disabled]

.


<% # Eval (" id ") % & gt;
<% # Eval (" kc_name ") % & gt; [ here by judging the value of the two fields in the database has a 1 shows for a "normal", both 0 shows "disable" ]


.
Table Settings
Id kc_name km2 km3
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
123 test a 1 0
124 the examination room 2 0 0


Could you tell me how to write the aspx page and cs page code to judge?

CodePudding user response:

String kc_name=database table field
String kc_name01=database table field
If (kc_name="1" | | kc_name01="1")
{
//normal
}
Else if (kc_name="0" and kc_name01="0")
{
//stop
}
The else
{

}

CodePudding user response:

Directly to the red part is modified to
<% # Eval (" km2 "). The ToString ()=="0" & amp; & The Eval (" km3 "). The ToString ()=="0"? "Disabled", "normal" % & gt;
Remove KM2 and KM3 to 0 is disabled, the opposite of normal
  •  Tags:  
  • C #
  • Related