网格中的下拉列表应根据dtaabse记录进行选择 [英] dropdown in grid should select as per dtaabse record
本文介绍了网格中的下拉列表应根据dtaabse记录进行选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Grid,在该网格中,一列是这样下拉的
i had one Grid,in that grid one column is drop down like this
<asp:TemplateField HeaderText="Type" ControlStyle-Width="55px">
<itemtemplate>
<asp:DropDownList ID="ddltype" runat="server" SelectedText='<%# Eval("Taxfeetype").ToString().ToLower().Equals("tax") ? "Tax" : "Fee" %>'>
<asp:ListItem Value="fee">Fee
<asp:ListItem Value="tax">Tax
</itemtemplate>
现在我有一个sql数据表以下栏目
now i had one sql data table with the following columns
Taxfeetype nvarchar(5),
Decription nvarchar(50),
PercentorFlat nvarchar(20),
TaxFeeValue decimal(10,4)
现在如果我输入一条这样的记录:
now if i enter one record like this:
insert into Testtaxandfess values('Tax','Surpls Lines Tax','percent',3.0000)
自动选择下拉税...
同样如果我写这样的记录:
automatically in dropdown tax should be selected...
similarly if i write record like this:
insert into Testtaxandfess values('Fee','Inspection Fee','percent',100.0000)
费用应默认选择....
请帮助
fee should be defaultly selected....
please help
推荐答案
刚刚用值替换了text属性............
< asp:dropdownlist id =ddltyperunat =serverselectedvalue =<%#Eval(taxfeetype)。tostring()。tolower()。equals(tax)= ?=tax=:=费用=%& gt;=xmlns:asp =#unknown>
just replaced text property with value............
<asp:dropdownlist id="ddltype" runat="server" selectedvalue="<%# Eval(" taxfeetype").tostring().tolower().equals("tax")="" ?="" "tax"="" :="" "fee"="" %>"="" xmlns:asp="#unknown">
这篇关于网格中的下拉列表应根据dtaabse记录进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文