点击datagrid 某行取值问题
dg_ItemDataBound事件中
public void dg_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Item)
{
string ContractName1 = Convert.ToString(DataBinder.Eval(e.Item.DataItem,"kkk",null));
e.Item.Style["cursor"] = "hand";
e.Item.Attributes.Add( "onclick ", "document.getElementById('TextBox7').value= "+ContractName1.Trim()+ "; ");
}
}
问题:
1.取字段 kkk 值 赋给 页面中的TextBox7。 kkk 值 为 18位数字,到了TextBox7显示 后面几位不对了。
2.如果kkk 是中文, 会报'中文名' is undefined.