DataGrid模板列如下:
<
asp:TemplateColumn
>
< HeaderTemplate >
信誉
</ HeaderTemplate >
< ItemTemplate >
<% # DataBinder.Eval(Container, " DataItem.Credit " ) %>
</ ItemTemplate >
< EditItemTemplate >
< asp:DropDownList id = " creditDlist " runat = " server " Width = " 50 " SelectedIndex = ' <%# DataBinder.Eval(Container, "DataItem.IndexCredit") %> ' >
< asp:ListItem Value = " 良好 " > 良好 </ asp:ListItem >
< asp:ListItem Value = " 较好 " > 较好 </ asp:ListItem >
< asp:ListItem Value = " 一般 " > 一般 </ asp:ListItem >
< asp:ListItem Value = " 较差 " > 较差 </ asp:ListItem >
</ asp:DropDownList >
</ EditItemTemplate >
</ asp:TemplateColumn >
SQL 语句如下:
< HeaderTemplate >
信誉
</ HeaderTemplate >
< ItemTemplate >
<% # DataBinder.Eval(Container, " DataItem.Credit " ) %>
</ ItemTemplate >
< EditItemTemplate >
< asp:DropDownList id = " creditDlist " runat = " server " Width = " 50 " SelectedIndex = ' <%# DataBinder.Eval(Container, "DataItem.IndexCredit") %> ' >
< asp:ListItem Value = " 良好 " > 良好 </ asp:ListItem >
< asp:ListItem Value = " 较好 " > 较好 </ asp:ListItem >
< asp:ListItem Value = " 一般 " > 一般 </ asp:ListItem >
< asp:ListItem Value = " 较差 " > 较差 </ asp:ListItem >
</ asp:DropDownList >
</ EditItemTemplate >
</ asp:TemplateColumn >
select ID,Supp_Custom_NO,Name,rtrim(Phone) as Phone,rtrim(Fax) as Fax,Telation,Address,Zip,
case
when Credit='A' then '良好'
when Credit='B' then '较好'
when Credit='C' then '一般'
when Credit='D' then '较差'
end as Credit,
case
when Credit='A' then 0
when Credit='B' then 1
when Credit='C' then 2
when Credit='D' then 3
end as IndexCredit
from Supp_Custom_TB order by Supp_Custom_NO