<script type="text/javascript">
function OnClientSelectedIndexChanged(sender, eventArgs) {
var item = eventArgs.get_item().get_attributes()._data.BNKNM;
document.getElementById("Q_txtBNKNM").value = item;
}
</script>
<ILS:ILSRadComboBox ID="Q_cbxBNKID" runat="server" ColumnName="BNKID" Filter="Contains" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" Onchange="OnClientSelectedIndexChanged">
<HeaderTemplate>
<table style="width: 150px" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 25px;">代號
</td>
<td style="width: 125px; align-items: center;">名稱
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table style="width: 150px" cellspacing="0" cellpadding="0">
<tr>
<td id="td_cbxBNKID" style="width: 25px;">
<%# DataBinder.Eval(Container, "Attributes['BNKID']")%>
</td>
<td id="td_cbxBNKNM" style="width: 125px;">
<%# DataBinder.Eval(Container, "Attributes['BNKNM']")%>
</td>
</tr>
</table>
</ItemTemplate>
</ILS:ILSRadComboBox>
------------------------------------下面是連資料庫產生值
DataTable dt = DKHIFIComManager.Get_DKHIFI_USP_COM_FBNKID_AS01("", "");
DataRow dr = dt.NewRow();
dr["BNKID"] = string.Empty;
dr["BNKNM"] = string.Empty;
dt.Rows.InsertAt(dr, dt.Rows.Count);
foreach (DataRow dataRow in dt.Rows)
{
RadComboBoxItem item = new RadComboBoxItem();
item.Text = dataRow["BNKID"].ToString();//combobox
item.Value = dataRow["BNKID"].ToString();
string BNKID = (string)dataRow["BNKID"];
string BNKNM = (string)dataRow["BNKNM"];
item.Attributes.Add("BNKID", BNKID);
item.Attributes.Add("BNKNM", BNKNM);
Q_cbxBNKID.Items.Add(item);
item.DataBind();
}
沒有留言:
張貼留言