if (e.Row.RowType == DataControlRowType.DataRow)
{
switch(e.Row.Cells[11].Text)
{
case "1":
e.Row.Cells[11].Text="<font blue=red>自辦</font>";
break;
case "2":
e.Row.Cells[11].Text="<font blue=blue>委辦</font>";
break;
case "3":
e.Row.Cells[11].Text="<font blue=yellow>派外</font>";
break;
}
}上面的代码,对1实现不了,对2就可以,问题出在哪?
1,<asp:TemplateField headertext="培訓類型">
<itemtemplate><%#Eval("TrainingKind")%></itemtemplate>
<edititemtemplate>
<asp:DropDownList runat="server" ID="ddlTrainingKind">
<asp:ListItem Text="自辦" Value="1"/>
<asp:ListItem Text="委辦" Value="2"/>
<asp:ListItem Text="派外" Value="3"/>
</asp:DropDownList>
</edititemtemplate>
</asp:TemplateField>
2,<asp:boundfield headertext="培訓類型" datafield="TrainingKind"/>
{
switch(e.Row.Cells[11].Text)
{
case "1":
e.Row.Cells[11].Text="<font blue=red>自辦</font>";
break;
case "2":
e.Row.Cells[11].Text="<font blue=blue>委辦</font>";
break;
case "3":
e.Row.Cells[11].Text="<font blue=yellow>派外</font>";
break;
}
}上面的代码,对1实现不了,对2就可以,问题出在哪?
1,<asp:TemplateField headertext="培訓類型">
<itemtemplate><%#Eval("TrainingKind")%></itemtemplate>
<edititemtemplate>
<asp:DropDownList runat="server" ID="ddlTrainingKind">
<asp:ListItem Text="自辦" Value="1"/>
<asp:ListItem Text="委辦" Value="2"/>
<asp:ListItem Text="派外" Value="3"/>
</asp:DropDownList>
</edititemtemplate>
</asp:TemplateField>
2,<asp:boundfield headertext="培訓類型" datafield="TrainingKind"/>
解决方案 »
- 读写word标签的问题,急!!
- 正则
- 问个 SQL查询语句
- button.click这个事件是怎么得来得?
- ●●●百思不得其解●●●
- asp.net2.0数据库入门经典(第四版)这本书怎么样??
- GridView中onrowcommand="CustomersGridView_RowCommand的事件中如何取得当前点击的是第几行,(不一定是选中的)
- 输出字体问题啊
- asp.net页面里如何设置Marquee的onmouseover事件使其停止滚动
- 为什么我的邮件发送不出去????100
- asp.net Office文件在线转换swf的问题
- 如何把字符串标签 如:[lable] 替换成 asp.net Lable 控件!
如果是 要用findeContor
e.Row.Cells[11].Text="<font blue=red>自辦</font>";
break;
blue =red ????这是什么???应该是color 吧。
哦,這個是寫錯了,是color,謝謝,不過不影響改變Cells的內容
.Row.Cells[11].Text="<font color="red">自辦</font>";
关键不在这,这只是个手误,修改后同样不能。
<itemtemplate><%#Eval("TrainingKind")%></itemtemplate>
e.Row.Cells[11].Text为什么会是空值呢,我查看源码是有数据呢
看到部分的如下:
<td>3</td>